protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (_windowMove) Location = PointToScreen(e.Location) - _windowMoveDelta; else _resizeShow = GetResizeAt(e.Location); }
public void SetResize(ControlResizeTypes resize) { resizeType = resize; _resizeDelta = MousePosition; _resizeOriginal = Size; _resizePosition = PointToScreen(Point.Zero); switch (resize) { case ControlResizeTypes.None: resizeActive = false; Application.activeResizeControl = null; break; default: resizeActive = true; Application.activeResizeControl = this; break; } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button == MouseButtons.Left) { resizeType = GetResizeAt(e.Location); SetResize(resizeType); if (resizeType == ControlResizeTypes.None) { // Move then. if (Movable) if (e.Location.Y < HeaderHeight) { _windowMoveDelta = e.Location; _windowMove = true; } } } }
private void _Application_UpClick(object sender, MouseEventArgs e) { _windowMove = false; resizeType = ControlResizeTypes.None; if (Application.activeResizeControl == this) Application.activeResizeControl = null; resizeActive = false; }