/// <summary> /// Begin movement by mouse /// </summary> /// <param name="mouseScreenPos">mouse down screen position</param> public void BeginMovementByMouse(Point mouseScreenPos) { if (Positioner.CanMove) { _mouseDownScreenPos = mouseScreenPos; _positionerPositionOnMouseDown = Positioner.Location; _sizeMode = zSizeMode.Move; _moving = false; } }
/// <summary> /// End movement by mouse /// </summary> public void EndMovementByMouse() { if (_moving) { Positioner.StopMoveByMouse(); _moving = false; } _sizeMode = zSizeMode.None; }
/// <summary> /// On mouse down in title bottom margin /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event arg</param> private void OnMouseDownInBottomMargin(object sender, MouseEventArgs e) { _sizeMode = zSizeMode.None; if (e.Button == MouseButtons.Left && Positioner.CanSizeBottom && CanResizeByMouse) { _mouseDownScreenPos = BottomMargin.PointToScreen(e.Location); _positionerPositionOnMouseDown = Positioner.Location; _positionerSizeOnMouseDown = Positioner.Size; _sizeMode = zSizeMode.Bottom; } }
/// <summary> /// On mouse down in title bar /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event arg</param> private void OnMouseDownInTitleBar(object sender, MouseEventArgs e) { _sizeMode = zSizeMode.None; if (e.Button == MouseButtons.Left) { if (_titleRenderer.TitleBarButtonIndexUnderMouse >= 0) { EventHandler handler = null; int index = -1; if (_titleRenderer.ShowContextMenuButton) { index++; if (index == _titleRenderer.TitleBarButtonIndexUnderMouse) { handler = ContextButtonClick; } } if (_titleRenderer.ShowAutohideButton) { index++; if (index == _titleRenderer.TitleBarButtonIndexUnderMouse) { handler = AutohideButtonClick; } } if (_titleRenderer.ShowCloseButton) { index++; if (index == _titleRenderer.TitleBarButtonIndexUnderMouse) { handler = CloseButtonClick; } } if (handler != null) { handler(this, EventArgs.Empty); } } else if (CanMoveByMouse) { BeginMovementByMouse(TitleBar.PointToScreen(e.Location)); } } }
/// <summary> /// On mouse released from bottom margin /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event arg</param> private void OnMouseUpFromBottomMargin(object sender, MouseEventArgs e) { _sizeMode = zSizeMode.None; }