< Day Day Up > |
Topics in This Chapter
Chapter 8, ".NET Graphics Using GDI+," focused on the use of GDI+ for creating graphics and working with images. This chapter continues the exploration of GDI+ with the focus shifting to its use for "drawing text." One typically thinks of text as being printed rather than drawn. In the .NET world, however, the display and rendering of text relies on techniques similar to those required to display any graphic: a Graphics object must be created, and its methods used to position and render text strings the shape of which is determined by the font used. This chapter begins with a look at fonts and an explanation of the relationship between fonts, font families, and typefaces. It then looks at the classes used to create fonts and the options for sizing them and selecting font styles. The Graphics.DrawString method is the primary tool for rendering text and has several overloads that support a number of formatting features: text alignment, text wrapping, the creation of columnar text, and trimming, to name a few. The chapter concludes with a detailed look at printing. An incremental approach is taken. A simple example that illustrates the basic classes is presented. Building on these fundamentals, a more complex and realistic multi-page report with headers, multiple columns, and end-of-page handling is presented. Throughout, the emphasis is on understanding the GDI+ classes that support printer selection, page layout, and page creation. |
< Day Day Up > |