October 2003
Intermediate to advanced
784 pages
14h 21m
English
In Chapter 5 we discussed how to use the ScaleTransform, RotateTransform, and TranslateTransform methods to transform text. We can also use a transformation matrix to transform text.
We create a Matrix object with the transformation properties and apply it to the surface using the Transform property of the Graphics object. Listing 10.21 creates a Matrix object and sets it as the Transform property. We then call DrawString, which draws the text on the form. To test this code, add the code to a form’s paint event handler.
Graphics g = e.Graphics; string str = "Colors, fonts, and text are common" + " elements of graphics programming." + "In this chapter, you learned " + " about ... |
Read now
Unlock full access