This documentation is archived and is not being maintained.
How to: Draw a Line on a Windows Form
.NET Framework 2.0
This example draws a line 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.