Exemplo n.º 1
0
 void MultiSelectAdd(TLNode clickedNode, Keys modifierKeys)
 {
     if (Control.ModifierKeys == Keys.None)
     {
         foreach (TLNode node in NodesSelection)
         {
             int newrow = NodeCollection.GetVisibleNodeIndex(node);
             InvalidateRow(newrow);
         }
         NodesSelection.Clear();
         NodesSelection.Add(clickedNode);
     }
     if (Control.ModifierKeys == Keys.Shift)
     {
         if (NodesSelection.Count == 0)
         {
             NodesSelection.Add(clickedNode);
         }
         else
         {
             int startrow = NodeCollection.GetVisibleNodeIndex(NodesSelection[0]);
             int currow   = NodeCollection.GetVisibleNodeIndex(clickedNode);
             if (currow > startrow)
             {
                 TLNode startingNode = NodesSelection[0];
                 NodesSelection.Clear();
                 foreach (TLNode node in NodeCollection.ForwardNodeIterator(startingNode, clickedNode, true))
                 {
                     NodesSelection.Add(node);
                 }
                 Invalidate();
             }
             if (currow < startrow)
             {
                 TLNode startingNode = NodesSelection[0];
                 NodesSelection.Clear();
                 foreach (TLNode node in NodeCollection.ReverseNodeIterator(startingNode, clickedNode, true))
                 {
                     NodesSelection.Add(node);
                 }
                 Invalidate();
             }
         }
     }
     if (Control.ModifierKeys == Keys.Control)
     {
         if (NodesSelection.Contains(clickedNode))
         {
             NodesSelection.Remove(clickedNode);
         }
         else
         {
             NodesSelection.Add(clickedNode);
         }
     }
     InvalidateRow(NodeCollection.GetVisibleNodeIndex(clickedNode));
     FocusedNode = clickedNode;
 }
Exemplo n.º 2
0
        public void EnsureVisible(TLNode node)
        {
            int screenvisible = MaxVisibleRows() - 1;
            int visibleIndex  = NodeCollection.GetVisibleNodeIndex(node);

            if (visibleIndex < VScrollValue())
            {
                SetVScrollValue(visibleIndex);
            }
            if (visibleIndex > VScrollValue() + screenvisible)
            {
                SetVScrollValue(visibleIndex - screenvisible);
            }
        }