dmitrysenkovich

Untitled

Jul 21st, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. private void treeView1_ItemDrag(object sender, ItemDragEventArgs e)
  2.         {
  3.             if (e.Button != MouseButtons.Left || (e.Item as TreeNode) == null)
  4.                 return;
  5.  
  6.             try
  7.             {
  8.                 string[] fileList = new string[] { (e.Item as TreeNode).Text.ToString() };
  9.                 DataObject fileDragData = new DataObject(DataFormats.FileDrop, fileList);
  10.                 DoDragDrop(fileDragData, DragDropEffects.Copy);
  11.             }
  12.             catch (Exception ex)
  13.             {
  14.                 MessageBox.Show(ex.Message, "DragNDrop Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  15.             }
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment