Graphics: DrawArc

image_pdfimage_print

using System;
using System.Drawing;
using System.Windows.Forms;

class DashedEllipse: Form
{
public static void Main()
{
Application.Run(new DashedEllipse());
}
public DashedEllipse()
{
Text = “Dashed Ellipse Using DrawArc”;
ResizeRedraw = true;
}
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)
{
Pen pen = new Pen(clr);
Rectangle rect = new Rectangle(0, 0, cx – 1, cy – 1);

for (int iAngle = 0; iAngle < 360; iAngle += 15) grfx.DrawArc(pen, rect, iAngle, 10); } } [/csharp]

This entry was posted in 2D Graphics. Bookmark the permalink.