简体   繁体   English

PointF数组的所有值都相同

[英]PointF array has all values the same

On every new click I get new coordinates and save them in points but it also changes old values. 每次单击新按钮,我都会获得新坐标并将其保存为点数,但它也会更改旧值。 For example 例如

First click: points[(156, 25), (0, 0), (0, 0)] 首次点击:点[(156,25),(0,0),(0,0)]

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

Third click: points[(15, 120), (15, 120), (15, 120)] 第三次点击:点[(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++;
}

您应该使用eX和eY而不是Location,因为Location是表单的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM