Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# c窗口窗体中的绘图点_C#_Draw_Point - Fatal编程技术网

C# c窗口窗体中的绘图点

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

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.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的值很大,在我的屏幕上无法绘制。谢谢!!: