[英]How to use GetChildAtPoint with PointF
Im trying to write a basic drawing app with some formulas that requires me to keep my points precise. 我试图用一些公式编写一个基本的绘图应用程序,这需要我保持观点精确。 all is working well but one part that will allow me to proceed with this program.
一切运行良好,但只有一部分可以使我继续进行此程序。 I need to use the
Control.GetChildAtPoint
Method to see if there is an object at a certain point of the line but my points is all in pointF
( float
). 我需要使用
Control.GetChildAtPoint
方法来查看在该行的某个点是否存在一个对象,但我的要点全部在pointF
( float
)中。 here is a short piece of the code that should make sense. 这是一小段应该有意义的代码。
if (poscount > 15) {
//to see if point is close to an object
if (this.GetChildAtPoint(point2) != null) {
label1.Text = "I found an object";
} else label1.Text = " no object found";
}
Sorry for the stupid example but at the point2 (which is a
pointF ) it gives an error that I cant convert from a
float to
System.Drawing.Point . I cant find a way to convert it and keep the accuracy. Is there a way I can use
对不起这个愚蠢的例子,但是在
point2 (which is a
pointF ) it gives an error that I cant convert from a
float ) it gives an error that I cant convert from a
to
System.Drawing.Point . I cant find a way to convert it and keep the accuracy. Is there a way I can use
. I cant find a way to convert it and keep the accuracy. Is there a way I can use
. I cant find a way to convert it and keep the accuracy. Is there a way I can use
GetChildAtPoint with a
float`? . I cant find a way to convert it and keep the accuracy. Is there a way I can use
GetChildAtPoint with a
float with a
?
The argument could be converted as follows. 该参数可以如下转换。
if (poscount > 15)
{
// to see if point is close to an object
Point iPoint = new Point((int)point2.X, (int)point2.Y);
if (this.GetChildAtPoint(iPoint) != null)
{
label1.Text = "I found an object";
}
else
{
label1.Text = " no object found";
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.