示例#1
0
 public void Dispose()
 {
     if (_drag != null)
     {
         _drag.Dispose();
         _drag = null;
     }
 }
示例#2
0
        protected override void OnDragStart(MouseEventArgs args)
        {
            base.OnDragStart(args);

            _dragging = true;

            _rectangleDrag = new RectangleDrag();
            _bounds        = Control.Bounds;

            using (DesktopGraphics graphics = new DesktopGraphics())
            {
                _rectangleDrag.Start(GetScreenRectangle(_bounds), graphics);
            }

            _flags = GetDirectionFlags(GetDragDirection(args.Location));
        }
示例#3
0
        public Rectangle End()
        {
            Rectangle result;

            using (DesktopGraphics graphics = new DesktopGraphics())
            {
                result = _drag.End(graphics);
            }

            _drag.Dispose();
            _drag = null;

            _setCursor.Dispose();
            _setCursor = null;

            return(result);
        }
示例#4
0
        protected override void OnDragCancelled()
        {
            _dragging = false;

            using (DesktopGraphics graphics = new DesktopGraphics())
            {
                if (_rectangleDrag != null)
                {
                    _rectangleDrag.End(graphics);
                    _rectangleDrag.Dispose();
                    _rectangleDrag = null;
                }
            }

            SetCursor(null);

            base.OnDragCancelled();
        }
示例#5
0
        protected override void OnDragEnd(MouseEventArgs args)
        {
            _dragging = false;

            Rectangle bounds = GetSizedRectangle();

            using (DesktopGraphics graphics = new DesktopGraphics())
            {
                if (_rectangleDrag != null)
                {
                    _rectangleDrag.End(graphics);
                    _rectangleDrag.Dispose();
                    _rectangleDrag = null;
                }
            }

            SetCursor(null);
            Control.Bounds = bounds;
            Control.Invalidate();

            base.OnDragEnd(args);
        }
示例#6
0
        public void Start(Point startPoint)
        {
            if (_enabled)
            {
                _drag       = new RectangleDrag();
                _startPoint = startPoint;

                if (_dragCursor != null)
                {
                    if (_setCursor != null)
                    {
                        _setCursor.Dispose();
                    }

                    _setCursor = new SetCursor(_dragCursor);
                }

                using (DesktopGraphics graphics = new DesktopGraphics())
                {
                    _drag.Start(_control.Parent.RectangleToScreen(_control.Bounds), graphics);
                }
            }
        }