How to: Draw a Filled Rectangle on a Windows Form
.NET Framework 3.0
This example draws a filled rectangle on a form.
Compiling the Code
You cannot call this method in theevent 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 method.
You should always callon any objects that consume system resources, such as and objects.