Chapter 19: Graphics with GDI

 
Chapter 19 - Graphics with GDI+
bySimon Robinsonet al.
Wrox Press 2002
  

Overview

This is the second of the two chapters in this book that cover the elements of interacting directly with the user; displaying information on the screen and accepting user input. In Chapter 7 we focused on Windows Forms, where we learned how to display a dialog box or SDI or MDI window, and how to place various controls on it such as buttons , textboxes, and listboxes. We used these familiar, predefined controls at a high level and relied on the fact that they are able to take full responsibility for getting themselves drawn on the display device.

Although these standard controls are powerful, and are by themselves quite adequate for the complete user interface for many applications, there are situations in which you need more flexibility in your user interface. For example, you may 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 from Chapter 7. To display that kind of output, the application must take direct responsibility for telling the operating system precisely what needs to be displayed where in its window.

Therefore, in this chapter we're going to show you how to draw a variety of items including:

  • Lines and simple shapes

  • Images from bitmap and other image files

  • Text

In the process, we'll also 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). We'll also go into some detail on how devices interpret and display different colors.

We'll start, however, by discussing a technology called GDI+ . GDI+ consists of the set of .NET base classes that are available to carry out 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 monitor screen (or printed to a hard copy).

  


Professional C#. 2nd Edition
Performance Consulting: A Practical Guide for HR and Learning Professionals
ISBN: 1576754359
EAN: 2147483647
Year: 2002
Pages: 244

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