private void Tree_ItemDrag(object sender, ItemDragEventArgs e) { // Get the tree. TreeView tree = (TreeView)sender; // Get the node underneath the mouse. ProtocolNode selectedNode = (ProtocolNode)mProtocolTreeView.SelectedNode; tree.SelectedNode = selectedNode; // Start the drag-and-drop operation with a cloned copy of the node. if (selectedNode != null) { tree.DoDragDrop((ProtocolNode)selectedNode.Clone(), DragDropEffects.Move); } }
private void setLinkIdToolStripMenuItem_Click(object sender, EventArgs e) { var dlg = new TreeNodeSelect((ProtocolNode)mProtocolNode.Clone(), (ProtocolNode)getSelNode().Clone()); dlg.Text = "Select Link node"; if (dlg.ShowDialog() == DialogResult.OK) { var node = (ProtocolNode)dlg.TreeView.SelectedNode; if (node != null) { var curNode = getSelNode(); curNode.LinkId = node.Id; mLinkLabelText.Text = node.Id.ToString(); mLinkTextBox.Text = node.Text; } // to do: add undo-redo support } }