gpt4 book ai didi

c# - 为什么我的计算不起作用?

转载 作者:太空宇宙 更新时间:2023-11-03 13:48:26 25 4
gpt4 key购买 nike

<分区>

这更像是一个为什么这行不通的问题。我显然一定遗漏了一些东西,因为我终其一生都无法弄清楚为什么计算宽度和高度值会给我开始时使用的相同静态值。但是当我替换硬编码值时,它工作得很好。所以很明显我的计算很糟糕,但我似乎无法弄清楚为什么。谁能帮忙?如果您需要更多信息,请询问。

 if(objectList[selectedIndex].Selected == true)
{
//The width would be mouselocationx - objectlocationx
//The height would be mouselocationy - objectlocationy
//Off set the position so it doesnt snap to mouse location
//WHY THE *%$!! DOESNT THIS WORK!!?!?!?!?!?!?
//int width = e.X - objectList[selectedIndex].X;
//int height = e.Y - objectList[selectedIndex].Y;
//Why is this so hard??
//Point location = objectList[selectedIndex].Location;
//location.X = e.X - (e.X - objectList[selectedIndex].Location.X);
//location.Y = e.Y - (e.Y - objectList[selectedIndex].Location.Y);
objectList[selectedIndex].X = e.Location.X - 12;
objectList[selectedIndex].Y = e.Location.Y - 12;
objectLocationXLabel.Text = "OBJX: " + objectList[selectedIndex].X.ToString();
objectLocationYLabel.Text = "OBJY: " + objectList[selectedIndex].Y.ToString();
panel1.Invalidate();
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com