예제 #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);
                }
            }
        }