我有一个关于螺旋绘图的问题。
以下来源来自链接。
http://www.java2s.com/Code/CSharp/2D-Graphics/Spiral.htm
螺旋为您提供空间。
我希望螺旋填满屏幕。
protected override void OnPaint(PaintEventArgs pea)
{
DoPage(pea.Graphics, ForeColor, ClientSize.Width,ClientSize.Height);
}
protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
{
const int iNumRevs = 3;
int iNumPoints = iNumRevs * 2 * (cx + cy);
PointF[] aptf = new PointF[iNumPoints];
float fAngle, fScale;
for (int i = 0; i < iNumPoints; i++)
{
fAngle = (float)(i * 2 * Math.PI / (iNumPoints / iNumRevs));
fScale = 1 - (float)i / iNumPoints;
aptf[i].X = (float)(cx / 2 * (1 + fScale * Math.Cos(fAngle)));
aptf[i].Y = (float)(cy / 2 * (1 + fScale * Math.Sin(fAngle)));
}
grfx.DrawLines(new Pen(clr), aptf);
}
图片
30秒到达战场
相关分类