예제 #1
0
        private void TreeNode_SelectChanged(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            DirDiffTreeView    Tree  = (DirDiffTreeView)sender;
            DirectoryDiffEntry Entry = Tree.GetEntryForNode(e.Node);

            if (Entry != null)
            {
                TreeNode NodeA = Entry.NodeA;
                TreeNode NodeB = Entry.NodeB;
                if (NodeA != null && NodeB != null)
                {
                    TreeA.SelectedNode = NodeA;
                    TreeB.SelectedNode = NodeB;
                }
            }

            UpdateButtons();
        }
예제 #2
0
        private void TreeNode_StateChange(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            DirDiffTreeView    Tree  = (DirDiffTreeView)sender;
            DirectoryDiffEntry Entry = Tree.GetEntryForNode(e.Node);

            if (Entry != null)
            {
                TreeNode NodeA = Entry.NodeA;
                TreeNode NodeB = Entry.NodeB;
                if (NodeA != null && NodeB != null)
                {
                    if (e.Action == TreeViewAction.Collapse)
                    {
                        //Although the Docs say that Collapse() isn't recursive,
                        //it actually is.  Since clicking the +/- isn't recursive
                        //we have to simulate that by calling Collapse even on the
                        //node that fired the event.
                        if (NodeA.IsExpanded || e.Node == NodeA)
                        {
                            NodeA.Collapse();
                        }
                        if (NodeB.IsExpanded || e.Node == NodeB)
                        {
                            NodeB.Collapse();
                        }
                    }
                    else if (e.Action == TreeViewAction.Expand)
                    {
                        if (!NodeA.IsExpanded || e.Node == NodeA)
                        {
                            NodeA.Expand();
                        }
                        if (!NodeB.IsExpanded || e.Node == NodeB)
                        {
                            NodeB.Expand();
                        }
                    }
                }
            }
        }