我想提请使用下面的代码在WinForm的某种图形:我试图绘制浮点值的东西在C#中,但我没有成功
private void button1_Click(object sender, EventArgs e)
{
Pen myPen = new System.Drawing.Pen(Color.Red);
Graphics handler = this.CreateGraphics();
double[] nextPt = new double[2];
double[] maurerPt = new double[2];
for (int index = 1; index < 361; index++)
{
nextPt = calcRose(index * d);
//this line is incorrect but Drawline only accept Point which is int
//and valued are in fractions thats why I use double
handler.DrawLine(maurerPt[0], maurerPt[1], nextPt[0], nextPt[1];
nextPt.CopyTo(maurerPt,2);
}
myPen.Dispose();
handler.Dispose();
}
问题是我想创造某种数学图的东西叫做“maruer rose” 并且由于我的行数值是分数,所以我不能使用只接受int值的Point
我该如何使用double或float值来提供drawline?
关于。
Graphics.DrawLine()有一个接受PointF的重载。只能绘制Paint事件btw。 –