Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

How to: Draw a Filled Ellipse on a Windows Form

This example draws a filled ellipse on a form.

Example

System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);
System.Drawing.Graphics formGraphics;
formGraphics = this.CreateGraphics();
formGraphics.FillEllipse(myBrush, new Rectangle(0, 0, 200, 300));
myBrush.Dispose();
formGraphics.Dispose();

Compiling the Code

You cannot call this method in the Load event handler. The drawn content will not be redrawn if the form is resized or obscured by another form. To make your content automatically repaint, you should override the OnPaint method.

Robust Programming

You should always call Dispose on any objects that consume system resources, such as Brush and Graphics objects.

See Also

Community Additions

ADD
Show:
© 2015 Microsoft