No Opinions...just code

Set 'COPY' action onto clipboard

  746 private void cutToolStripMenuItem1_Click(object sender, EventArgs e)
  747  {
  748      System.Collections.Specialized.StringCollection currDroplist =
new
System.Collections.Specialized.StringCollection();
  749 
  750      for (int x = 0; x < m_ListOFSelectedFiles.Count; x++)
  751      {
  752          currDroplist.Add(m_ListOFSelectedFiles[x].ToString());
  753      }
  754 
  755      // we havew to manually set the dragdropeffect bit when using our program //
  756      IDataObject data = new DataObject(DataFormats.FileDrop, currDroplist);
  757      MemoryStream ms = new MemoryStream(4);
  758      // set the effect to move //
  759      Byte[] ddf = new byte[] { (byte)DragDropEffects.Move, 0, 0, 0 };
  760      ms.Write(ddf, 0, ddf.Length);
  761 
  762      data.SetData("Preferred DropEffect", ms);
  763 
  764      // add the whole thing to the clipboard //
  765      Clipboard.SetDataObject(data);
  766  }

0 comments: