private static void MouseDown(Control control, MouseEventArgs e, TypeMover workType) { if (_moving || _resizing) return; _cursorStartPoint = e.Coord - control.Location; UpdateMouseEdgeProperties(control, e.Coord, workType); UpdateMouseCursor(control, workType); if ((workType & TypeMover.Resize) == TypeMover.Resize && (_mouseIsInRightEdge || _mouseIsInLeftEdge || _mouseIsInTopEdge || _mouseIsInBottomEdge)) _resizing = true; if ((workType & TypeMover.Move) == TypeMover.Move) _moving = true; }
private void p_MouseClick(Control sender, MouseEventArgs e) { GameWindow.Title = "[Panel] Mouse Click: " + (j++); }
private void Game1_MouseClick(Control sender, MouseEventArgs e) { GameWindow.Title = "[Form] Mouse Click: " + (j++); }
private void b_MouseClick(Control sender, MouseEventArgs e) { GameWindow.Title = "[Button] Mouse Click: " + (j++); }
private static void MouseMove(Control control, MouseEventArgs e, TypeMover workType) { if (!_resizing && !_moving) UpdateMouseEdgeProperties(control, e.Coord, workType); Vector2 cur = e.Coord - control.Location; if (_resizing) { if (_mouseIsInLeftEdge) { if (_mouseIsInTopEdge) { control.Width -= (cur.X - _cursorStartPoint.X); control.Left += (cur.X - _cursorStartPoint.X); control.Height -= (cur.Y - _cursorStartPoint.Y); control.Top += (cur.Y - _cursorStartPoint.Y); } else if (_mouseIsInBottomEdge) { control.Width -= (cur.X - _cursorStartPoint.X); control.Left += (cur.X - _cursorStartPoint.X); control.Height = cur.Y + Border; } else { control.Width -= (cur.X - _cursorStartPoint.X); control.Left += (cur.X - _cursorStartPoint.X); } } else if (_mouseIsInRightEdge) { if (_mouseIsInTopEdge) { control.Width = cur.X + Border; control.Height -= (cur.Y - _cursorStartPoint.Y); control.Top += (cur.Y - _cursorStartPoint.Y); } else if (_mouseIsInBottomEdge) { control.Width = cur.X + Border; control.Height = cur.Y + Border; } else control.Width = cur.X + Border; } else if (_mouseIsInTopEdge) { control.Height -= (cur.Y - _cursorStartPoint.Y); control.Top += (cur.Y - _cursorStartPoint.Y); } else if (_mouseIsInBottomEdge) control.Height = cur.Y + Border; else MouseUp(control, workType); } else if (_moving) { float x = (e.X - _cursorStartPoint.X); float y = (e.Y - _cursorStartPoint.Y); control.Location = _cursorStartPoint = new Vector2(x, y); } UpdateMouseCursor(control, workType); }