Chapter 25: Graphics with GDI


Overview

This is the third of the three chapters that deal with user interaction and the .NET Framework. Chapter 23, "Windows Forms," focused on Windows Forms and discussed how to display a dialog box or SDI or MDI window, and how to place various controls such as buttons, text boxes, and list boxes. Chapter 24, "Viewing .NET Data," looked at working with data in Windows Forms using a number of the Windows Forms controls that work with the disparate data sources that you might encounter.

Although these standard controls are powerful and, by themselves, quite adequate for the complete user interface for many applications, there are some situations in which you need more flexibility. For example, you might want to draw text in a given font in a precise position in a window, display images without using a picture box control, or draw simple shapes or other graphics. None of this can be done with the controls discussed in Chapter 23. To display that kind of output, the application must instruct the operating system what to display and where in its window to display it.

Therefore, this chapter shows you how to draw a variety of items including:

  • Lines and simple shapes

  • .BMP images and other image files

  • Text

In the process, you'll need to use a variety of helper objects, including pens (to define the characteristics of lines), brushes (to define how areas are filled in), and fonts (to define the shape of the characters of text). The chapter also goes into some detail on how devices interpret and display different colors.

The chapter starts, however, by discussing a technology called GDI+. GDI+ consists of the set of.NET base classes that are available to control custom drawing on the screen. These classes arrange for the appropriate instructions to be sent to graphics device drivers to ensure the correct output is placed on the screen (or printed to a hard copy).




Professional C# 2005
Pro Visual C++ 2005 for C# Developers
ISBN: 1590596080
EAN: 2147483647
Year: 2005
Pages: 351
Authors: Dean C. Wills

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net