C# c窗口窗体中的绘图点
Visual studio表示存在未处理的溢出异常C# c窗口窗体中的绘图点,c#,draw,point,C#,Draw,Point,Visual studio表示存在未处理的溢出异常 //draws the point. public void Draw(Graphics g) { float radius = 3; //radius of the circle which describes the point. // draws the circle of the point, with parameters of the square which bounds the circle. g.Dr
//draws the point.
public void Draw(Graphics g)
{
float radius = 3; //radius of the circle which describes the point.
// draws the circle of the point, with parameters of the square which bounds the circle.
g.DrawEllipse(new Pen(Color.Black, 6F), float.Parse((this.X - radius).ToString()), float.Parse((this.Y - radius).ToString()), 2 * radius, 2 * radius);
}
最终得到的点值超出了图形边界。检查您的this.X和this.Y值。请参见为什么要在此处分析ToString的结果?或者换一种方式,是什么类型的this.X和this.Y导致您需要这样做?X,Y是双精度的,但是g对象采用float类型参数。我发现了问题。谢谢你的帮助!:是的,就是这样,x和y的值很大,在我的屏幕上无法绘制。谢谢!!: