Chapter 10. Drawing and GDI+

The designers of .NET, and especially of Visual Studio .NET, clearly had in mind a model in which you could write sophisticated Windows Applications using only the controls available in the Toolbox. This approach is very successful, and many Windows programmers will never need to go beyond the Toolbox and forms model for building powerful user interfaces.

As discussed elsewhere in this book, the Toolbox includes controls for displaying data (labels, DataGrids, Calendars, listboxes, etc.) as well as for offering the user choices (radio buttons, checkboxes, listboxes, etc.) and for gathering data (text boxes, etc.) In addition, several controls and components manage date and time (Timer, etc.) or the form itself (splitter, etc.).

From time to time, however, you will want to display data in a way that is not possible with just the controls offered in the Toolbox. You might wish to draw on a control, or directly on the form itself, and for that you'll need the tools made available through GDI+ and the Graphics object.

To get an idea of what you can accomplish with these tools, this chapter first covers the basics with simple demonstration programs. It then focuses on a small but complete project, in which you will create an analog clock.

Get Programming .NET Windows Applications 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.