public void Dispose() { if (_drag != null) { _drag.Dispose(); _drag = null; } }
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)); }
public Rectangle End() { Rectangle result; using (DesktopGraphics graphics = new DesktopGraphics()) { result = _drag.End(graphics); } _drag.Dispose(); _drag = null; _setCursor.Dispose(); _setCursor = null; return(result); }
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(); }
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); }
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); } } }