簡體   English   中英

PointF數組的所有值都相同

[英]PointF array has all values the same

每次單擊新按鈕,我都會獲得新坐標並將其保存為點數,但它也會更改舊值。 例如

首次點擊:點[(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++;
}

您應該使用eX和eY而不是Location,因為Location是表單的位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM