1 private void copyToolStripMenuItem_Click(object sender, EventArgs e)
2 { 3 System.Collections.Specialized.StringCollection currDroplist =
new System.Collections.Specialized.StringCollection();
4
5 for (int x = 0; x < m_ListOFSelectedFiles.Count; x++)
6 { 7 currDroplist.Add(m_ListOFSelectedFiles[x].ToString());
8 }
9
10 // we havew to manually set the dragdropeffect bit when using our program //
11 IDataObject data = new DataObject(DataFormats.FileDrop, currDroplist);
12 MemoryStream ms = new MemoryStream(4);
13 // set the effect to copy -- Copy is actually copy Or link//
14 Byte[] ddf = new byte[] { (byte)(DragDropEffects.Copy | DragDropEffects.Link), 0, 0, 0 }; 15 ms.Write(ddf, 0, ddf.Length);
16
17 data.SetData("Preferred DropEffect", ms); 18
19 // add the whole thing to the clipboard //
20 Clipboard.SetDataObject(data);
21 }
0 comments:
Post a Comment