public void RemoveSelectedNode(MultiSelectTreeNode node) { selectedNodes.Remove(node); node.UnSelect(false); TreeViewEventArgs e = new TreeViewEventArgs(node); OnAfterSelect(e); }
public void RemoveSelectedNode(MultiSelectTreeNode node) { selectedNodes.Remove(node); node.UnSelect(false); TreeViewEventArgs e = new TreeViewEventArgs(node); OnAfterSelect(e); }
protected override void OnMouseClick(MouseEventArgs e) { MultiSelectTreeNode nodeHit = base.HitTest(e.X, e.Y).Node as MultiSelectTreeNode; if (e.Button == MouseButtons.Left) { MultiSelectTreeNode multiNode = nodeHit as MultiSelectTreeNode; if (multiNode != null && selectedNodes != null) { if ((Control.ModifierKeys & Keys.Control) == 0 && selectedNodes.Count != 0) { for (int i = 0; i < selectedNodes.Count && selectedNodes.Count != 0;) { MultiSelectTreeNode node = selectedNodes[i]; if (node != null && node != multiNode) { node.UnSelect(); } else { i++; } } if (!selectedNodes.Contains(multiNode)) { multiNode.Select(); } else { multiNode.UnSelect(); } } else { if (multiNode.IsSelected) { multiNode.UnSelect(); } else { multiNode.Select(); } } } } if (e.Button == MouseButtons.Right) { MultiSelectTreeNode treeNode = nodeHit as MultiSelectTreeNode; if ((Control.ModifierKeys & Keys.Control) == 0) { //if (SelectedObject.Count = 1) //{ // if (SelectedObject.Contains(treeNode.WorldObject)) // { // return; // } // else // { // SelectedObject[0].Node.UnSelect(); // SelectedObject.Add(treeNode.WorldObject); // } //} if (selectedNodes.Count >= 1) { if (selectedNodes.Contains(treeNode)) { return; } for (int i = selectedNodes.Count - 1; i >= 0; i--) { selectedNodes[i].UnSelect(); } } if (selectedNodes.Count == 0) { treeNode.Select(); } } else { return; } } base.OnMouseClick(e); }