コード例 #1
0
 //-------------------------------------------------------------------------
 void OnExpandAllChildren(object sender, EventArgs e)
 {
     BeginUpdate();
     if (MultiSelect && NodesSelection.Count > 0)
     {
         foreach (timos.supervision.Node selnode in NodesSelection)
         {
             selnode.ExpandAll();
         }
         NodesSelection.Clear();
     }
     if (FocusedNode != null)
     {
         FocusedNode.ExpandAll();
     }
     EndUpdate();
 }
コード例 #2
0
 private void ExpandAllItemClick(object sender, EventArgs eventArgs)
 {
     FocusedNode.ExpandAll();
 }
コード例 #3
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            Node newnode = null;

            if (e.KeyCode == Keys.PageUp)
            {
                int remainder = 0;
                int diff      = MaxVisibleRows(out remainder) - 1;
                newnode = NodeCollection.GetNextNode(FocusedNode, -diff);
                if (newnode == null)
                {
                    newnode = Nodes.FirstVisibleNode();
                }
            }
            if (e.KeyCode == Keys.PageDown)
            {
                int remainder = 0;
                int diff      = MaxVisibleRows(out remainder) - 1;
                newnode = NodeCollection.GetNextNode(FocusedNode, diff);
                if (newnode == null)
                {
                    newnode = Nodes.LastVisibleNode(true);
                }
            }

            if (e.KeyCode == Keys.Down)
            {
                newnode = NodeCollection.GetNextNode(FocusedNode, 1);
            }
            if (e.KeyCode == Keys.Up)
            {
                newnode = NodeCollection.GetNextNode(FocusedNode, -1);
            }
            if (e.KeyCode == Keys.Home)
            {
                newnode = Nodes.FirstNode;
            }
            if (e.KeyCode == Keys.End)
            {
                newnode = Nodes.LastVisibleNode(true);
            }
            if (e.KeyValue == 109) // Touche (-) numérique
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded)
                    {
                        FocusedNode.Collapse();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                }
            }
            if (e.KeyCode == Keys.Left)
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded)
                    {
                        FocusedNode.Collapse();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                    if (FocusedNode.Parent != null)
                    {
                        FocusedNode = FocusedNode.Parent;
                        EnsureVisible(FocusedNode);
                    }
                }
            }
            if (e.KeyValue == 107) // Touche (+) numérique
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded == false && FocusedNode.HasChildren)
                    {
                        FocusedNode.Expand();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                }
            }
            if (e.KeyCode == Keys.Right)
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded == false && FocusedNode.HasChildren)
                    {
                        FocusedNode.Expand();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                    if (FocusedNode.Expanded == true && FocusedNode.HasChildren)
                    {
                        FocusedNode = FocusedNode.Nodes.FirstNode;
                        EnsureVisible(FocusedNode);
                    }
                }
            }
            if (e.KeyValue == 106) // Touche (*) numérique
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded == false && FocusedNode.HasChildren)
                    {
                        FocusedNode.ExpandAll();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                }
            }

            if (newnode != null)
            {
                if (MultiSelect)
                {
                    // tree behavior is
                    // keys none,		the selected node is added as the focused and selected node
                    // keys control,	only focused node is moved, the selected nodes collection is not modified
                    // keys shift,		selection from first selected node to current node is done
                    if (Control.ModifierKeys == Keys.Control)
                    {
                        FocusedNode = newnode;
                    }
                    else
                    {
                        MultiSelectAdd(newnode, Control.ModifierKeys);
                    }
                }
                else
                {
                    FocusedNode = newnode;
                }
                EnsureVisible(FocusedNode);
            }
            base.OnKeyDown(e);
        }