我有一個(gè)關(guān)于螺旋繪圖的問題。以下來源來自鏈接。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);}圖片
C# 繪制螺旋填充
人到中年有點(diǎn)甜
2021-06-10 14:04:39