How to: Fill a Shape with a Solid Color
.NET Framework 2.0
To fill a shape with a solid color, create aobject, and then pass that SolidBrush object as an argument to one of the fill methods of the class. The following example shows how to fill an ellipse with the color red.
In the following code, theconstructor takes a object as its only argument. The values used by the method represent the alpha, red, green, and blue components of the color. Each of these values must be in the range 0 through 255. The first 255 indicates that the color is fully opaque, and the second 255 indicates that the red component is at full intensity. The two zeros indicate that the green and blue components both have an intensity of 0.
The four numbers (0, 0, 100, 60) passed to themethod specify the location and size of the bounding rectangle for the ellipse. The rectangle has an upper-left corner of (0, 0), a width of 100, and a height of 60.
Compiling the Code
The preceding example is designed for use with Windows Forms, and it requires e, which is a parameter of the event handler.