private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { //_activeTree.SelectedNode.Tag as Identifier Identifier selectedID = new Identifier(Convert.ToInt32(_activeTree.SelectedNode.Name)); switch (e.ClickedItem.Name) { case "copyToolStripMenuItem": _clipBoard = new TreeClipBoard(TreeOperationEnum.COPY); _clipBoard.AddObjectToClipBoard(selectedID); break; case "copyChildrenToolStripMenuItem": _clipBoard = new TreeClipBoard(); _clipBoard.AddChildrenToClipBoard(selectedID); break; case "cutToolStripMenuItem": _clipBoard = new TreeClipBoard(TreeOperationEnum.CUT); _clipBoard.AddObjectToClipBoard(selectedID); break; case "pasteToolStripMenuItem": _clipBoard.DumpClipBoardHere(selectedID); if (_clipBoard.CurrentOperation == TreeOperationEnum.CUT) { _clipBoard = new TreeClipBoard(); //Cut only once } RefreshTree(_activeTree); break; } }
private void treeView1_ItemDrag(object sender, ItemDragEventArgs e) { Identifier selectedID = new Identifier(Convert.ToInt32(treeView1.SelectedNode.Name)); _clipBoard = new TreeClipBoard(TreeOperationEnum.CUT); _clipBoard.AddObjectToClipBoard(selectedID); this.DoDragDrop("Siirrä...", DragDropEffects.Move); }