Export (0) Print
Expand All

How to: Create a Solid Brush 

This example creates a SolidBrush object that can be used by a Graphics object for filling shapes.

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();

Robust Programming

After you have finished using them, you should call Dispose on objects that consume system resources, such as brush objects.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft