Drawing and Printing

As nifty as all the built-in controls are and as nicely as you can arrange them on forms using the Designer, user controls, and dialogs, sometimes you need to take things into your own hands and render the state of your form or control yourself. For example, if you need to compose a fancy About box, as shown in Figure 1.17, you'll need to handle the form's Paint event and do the drawing yourself.

Figure 1.17. Custom Drawing (See Plate 3)

The following is the Paint event-handling code to fill the inside of the About box:

 Private Sub AboutDialog_Paint(sender As Object, _ e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint ...

Get Windows Forms Programming in Visual Basic .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.