/// <summary> /// 设置光标状态 /// </summary> public bool SetCursorShape(int x, int y) { Point point = new Point(x, y); if (!ControlRect.Contains(point)) { Cursor.Current = Cursors.Arrow; return(false); } else if (smallRects[0].Contains(point)) { Cursor.Current = Cursors.SizeNWSE; mpoc = MousePosOnCtrl.TOPLEFT; } else if (smallRects[1].Contains(point)) { Cursor.Current = Cursors.SizeNESW; mpoc = MousePosOnCtrl.TOPRIGHT; } else if (smallRects[2].Contains(point)) { Cursor.Current = Cursors.SizeNESW; mpoc = MousePosOnCtrl.BOTTOMLEFT; } else if (smallRects[3].Contains(point)) { Cursor.Current = Cursors.SizeNWSE; mpoc = MousePosOnCtrl.BOTTOMRIGHT; } else if (sideRects[0].Contains(point)) { Cursor.Current = Cursors.SizeNS; mpoc = MousePosOnCtrl.TOP; } else if (sideRects[1].Contains(point)) { Cursor.Current = Cursors.SizeWE; mpoc = MousePosOnCtrl.LEFT; } else if (sideRects[2].Contains(point)) { Cursor.Current = Cursors.SizeNS; mpoc = MousePosOnCtrl.BOTTOM; } else if (sideRects[3].Contains(point)) { Cursor.Current = Cursors.SizeWE; mpoc = MousePosOnCtrl.RIGHT; } else { Cursor.Current = Cursors.Arrow; } return(true); }
private void Panel_MouseMove(object sender, MouseEventArgs e) { Panel p = sender as Panel; _mpoc = _dictPanl[p]; SetCursorShape(e.X, e.Y); if (e.Button == MouseButtons.Left) { ControlMove(); } }
/// <summary> /// 设置光标状态 /// </summary> public bool SetCursorShape(int x, int y) { Point point = new Point(x, y); if (!ControlRect.Contains(point)) { Cursor.Current = Cursors.Arrow; return false; } else if (smallRects[0].Contains(point)) { Cursor.Current = Cursors.SizeNWSE; mpoc = MousePosOnCtrl.TOPLEFT; } else if (smallRects[1].Contains(point)) { Cursor.Current = Cursors.SizeNS; mpoc = MousePosOnCtrl.TOP; } else if (smallRects[2].Contains(point)) { Cursor.Current = Cursors.SizeNESW; mpoc = MousePosOnCtrl.TOPRIGHT; } else if (smallRects[3].Contains(point)) { Cursor.Current = Cursors.SizeWE; mpoc = MousePosOnCtrl.RIGHT; } else if (smallRects[4].Contains(point)) { Cursor.Current = Cursors.SizeNWSE; mpoc = MousePosOnCtrl.BOTTOMRIGHT; } else if (smallRects[5].Contains(point)) { Cursor.Current = Cursors.SizeNS; mpoc = MousePosOnCtrl.BOTTOM; } else if (smallRects[6].Contains(point)) { Cursor.Current = Cursors.SizeNESW; mpoc = MousePosOnCtrl.BOTTOMLEFT; } else if (smallRects[7].Contains(point)) { Cursor.Current = Cursors.SizeWE; mpoc = MousePosOnCtrl.LEFT; } else { Cursor.Current = Cursors.Arrow; } return true; }
private void Panel_MouseLeave(object sender, EventArgs e) { Cursor.Current = Cursors.Default; _mpoc = MousePosOnCtrl.NONE; }