/// <summary> /// Populate the tree control with the Items. If rebuilding, then it should remember all expanded nodes /// </summary> /// <param name="rebuild">Indicates whether expanded nodes should be recalled.</param> public void BuildTree(bool rebuild) { _clickedNode = null; //KellyControls.TreeNode Node = null; var SelectedNodes = new List <KellyControls.TreeNode>(); var ExpandedNodePaths = new List <string>(); if (rebuild) { // Find all the paths of nodes that have their Expanded flags set to True. ExpandedNodePaths.AddRange(GetExpandedNodePaths(ItemTree.Nodes)); } ItemTree.Nodes.Clear(); FontStyle FontStyle = ItemTree.Font.Style; //... if (ItemTree.SelectedNodes.Count > 0) { _clickedNode = ItemTree.SelectedNodes[0]; } ItemTree.SelectedNodes = SelectedNodes; if (rebuild) { foreach (string FullPath in ExpandedNodePaths) { var FoundNodes = ItemTree.Nodes.Find(FullPath, true); if (FoundNodes != null) { for (int i = 0; i < FoundNodes.Length; i++) { FoundNodes[i].Expand(); } } } } //int Scroll = 0; //if (_scrollPositions.Keys.Contains(Document.GUID)) // Scroll = _scrollPositions[Document.GUID]; //ExplorerTree.VScrollPos = Scroll; }
/// <summary> /// Record the position of the mouse down event. /// </summary> private void Tree_MouseDown(object sender, MouseEventArgs e) { _clickedNode = (KellyControls.TreeNode)ItemTree.GetNodeAt(e.X, e.Y); }
/// <summary> /// Checks the item on the node specified to see if it is visible or not, updates the icon accordingly. /// </summary> private void UpdateIcon(KellyControls.TreeNode node) { }