我希望讓BUTTON2在過了特定的區域(例如:Ycoordinate <= 180)
的時候可以讓BUTTON2的位置移到目前滑鼠的位置(例如滑鼠的位置是(100,180))
程式碼如下:
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (Ycoordinate <= 180)
{
Point startingPoint1 = Cursor.Position;
startingPoint1.Offset(Cursor.Position.X, Cursor.Position.Y);
IsPainting = false;
Cursor.Position = (startingPoint1);
button2.Location = PointToScreen(startingPoint1);
button2.Visible = true;
}
}
為什麼這樣子跑不出我要的結果呢?