| Doing your own drawing |
|
|
|
|
The Paint event of a control is called everytimes the control needs to be redrawn. We can override the OnPaint method of the form class to do our own painting. The simplest such program is probably similar to:
We need to add an extra namespace System.Drawing to access the classes related to painting a control. The OnPaint method expect a PaintEventArgs argument, and with this argument we can access its Graphics property. The Graphics object referenced by the argument has a DrawString method which we use to write "Hello World". The other arguments to DrawString are the font and brush objects needed to draw the string and its position. |
| < Prev | Next > |
|---|














