int GetCursorY() { int cursorY = Cursor.Position.Y - DrawPanel.PointToScreen(Point.Empty).Y; int y = cursorY / (int)scale; if (y < 0) { y = 0; } if (y > height - 1) { y = height - 1; } return(y); }
int GetCursorX() { int cursorX = Cursor.Position.X - DrawPanel.PointToScreen(Point.Empty).X; int x = cursorX / (int)scale; if (x < 0) { x = 0; } if (x > width - 1) { x = width - 1; } return(x); }