Ejemplo n.º 1
0
        public override void MouseDown(TreeNodeAdvMouseEventArgs args)
        {
            if (args.Node != null)
            {
                Tree.ItemDragMode = true;
                Tree.ItemDragStart = args.ViewLocation;

                if (args.Button == MouseButtons.Left || args.Button == MouseButtons.Right)
                {
                    Tree.BeginUpdate();
                    try
                    {
                        Tree.CurrentNode = args.Node;
                        if (args.Node.IsSelected)
                            _mouseDownFlag = true;
                        else
                        {
                            _mouseDownFlag = false;
                            DoMouseOperation(args);
                        }
                    }
                    finally
                    {
                        Tree.EndUpdate();
                    }
                }

            }
            else
            {
                Tree.ItemDragMode = false;
                MouseDownAtEmptySpace(args);
            }
        }
Ejemplo n.º 2
0
 protected override void DoMouseOperation(TreeNodeAdvMouseEventArgs args)
 {
     if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null)
     {
         base.DoMouseOperation(args);
     }
     else if (CanSelect(args.Node))
     {
         Tree.SuspendSelectionEvent = true;
         try
         {
             SelectAllFromStart(args.Node);
         }
         finally
         {
             Tree.SuspendSelectionEvent = false;
         }
     }
 }
Ejemplo n.º 3
0
 protected virtual void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args)
 {
     Tree.ClearSelection();
 }
Ejemplo n.º 4
0
 protected virtual void DoMouseOperation(TreeNodeAdvMouseEventArgs args)
 {
     Tree.SuspendSelectionEvent = true;
     try
     {
         Tree.ClearSelection();
         if (args.Node != null)
             args.Node.IsSelected = true;
         Tree.SelectionStart = args.Node;
     }
     finally
     {
         Tree.SuspendSelectionEvent = false;
     }
 }
Ejemplo n.º 5
0
 public override void MouseUp(TreeNodeAdvMouseEventArgs args)
 {
     Tree.ItemDragMode = false;
     if (_mouseDownFlag)
     {
         if (args.Button == MouseButtons.Left)
             DoMouseOperation(args);
         else if (args.Button == MouseButtons.Right)
             Tree.CurrentNode = args.Node;
     }
     _mouseDownFlag = false;
 }
Ejemplo n.º 6
0
 private void OnNodeMouseDoubleClick(TreeNodeAdvMouseEventArgs args)
 {
     if (NodeMouseDoubleClick != null)
         NodeMouseDoubleClick(this, args);
 }
Ejemplo n.º 7
0
 private TreeNodeAdvMouseEventArgs CreateMouseArgs(MouseEventArgs e)
 {
     TreeNodeAdvMouseEventArgs args = new TreeNodeAdvMouseEventArgs(e);
     args.ViewLocation = e.Location;
     args.AbsoluteLocation = ToAbsoluteLocation(e.Location);
     args.ModifierKeys = ModifierKeys;
     args.Node = GetNodeAt(e.Location);
     NodeControlInfo info = GetNodeControlInfoAt(args.Node, args.AbsoluteLocation);
     args.ControlBounds = info.Bounds;
     args.Control = info.Control;
     return args;
 }
Ejemplo n.º 8
0
 public override void MouseUp(TreeNodeAdvMouseEventArgs args)
 {
     FinishResize();
 }
Ejemplo n.º 9
0
 public override void MouseDown(TreeNodeAdvMouseEventArgs args)
 {
 }
Ejemplo n.º 10
0
 protected override void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args)
 {
 }