Visual Studio中說,有一個發生OverflowException未處理繪圖點
//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);
}
爲什麼在這裏解析'ToString()'的結果?或者換一種說法,'this.X'和'this.Y'的類型是什麼導致你需要這樣做? –
X,Y是雙精度型,但g對象採用浮點型參數。我發現了這個問題。感謝您的幫助! :) –