Ejemplo n.º 1
0
        protected override void OnMouseDragBegin(int x, int y)
        {
            // do not call base here because the behaviour is specific for the ControlDesgner (does IUISelectionService.DragBegin)
            //

            IUISelectionService selectionServ = this.GetService(typeof(IUISelectionService)) as IUISelectionService;

            if (selectionServ != null)
            {
                // once ControlDesigner.MouseDragBegin is fired this will start getting dragover events.
                //
                Point         location = new Point(x, y);
                IDesignerHost host     = GetService(typeof(IDesignerHost)) as IDesignerHost;
                if (base.MouseButtonDown == MouseButtons.Middle && host != null && host.RootComponent != this.Control)
                {
                    location = this.Control.Parent.PointToClient(this.Control.PointToScreen(new Point(x, y)));
                    // I have to do this, because I get DragOver events fired for the control I am actually dragging
                    //
                    this.Control.AllowDrop = false;
                    selectionServ.DragBegin();
                }
                else
                {
                    selectionServ.MouseDragBegin(this.Control, location.X, location.Y);
                }
            }
        }
Ejemplo n.º 2
0
        protected virtual void OnMouseDragBegin(int x, int y)
        {
            IUISelectionService selectionServ = this.GetService(typeof(IUISelectionService)) as IUISelectionService;

            if (selectionServ != null && ((this.SelectionRules & SelectionRules.Moveable) == SelectionRules.Moveable))
            {
                // once this is fired the parent control (parentcontroldesigner) will start getting dragover events.
                //
                selectionServ.DragBegin();
            }
        }