How to: Create a Solid Brush (Visual C#)
This example demonstrates how to create a SolidBrush object.
Example
System.Drawing.SolidBrush myBrush;
myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
myBrush.Dispose();
Compiling the Code
This example requires:
- A Windows Forms Application project.
The code must be within the scope of the Form class. The instance of the form is represented by this.
Robust Programming
You should always call Dispose on any objects that consume system resources, such as Brush and Graphics objects.
See Also
Concepts
Designing a User Interface in Visual C#