PointF数组的所有值都相同

时间:2017-03-26 10:58:38

标签: c# arrays point

在每次点击新内容时,我都会获得新坐标并将其保存在 points 中,但它也会更改旧值。例如

首先点击:点[(156,25),(0,0),(0,0)]

第二次点击:点[(85,92),(85,92),(0,0)]

第三次点击:积分[(15,120),(15,120),(15,120)]

PointF[] points = new PointF[3];
private void Form1_MouseClick(object sender, MouseEventArgs e)
{
   points[angle] = new PointF(Location.X, Location.Y);
   angle++;
}

1 个答案:

答案 0 :(得分:1)

您应该使用e.X和e.Y,而不是位置,因为位置是表单的位置。

相关问题