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
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Create a Solid Brush 

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


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

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

© 2015 Microsoft