How to: Draw Text at a Specified Location
When you perform custom drawing, you can draw text in a single horizontal line starting at a specified point. You can draw text in this manner by using theoverloaded method of the class that takes a or parameter. The DrawString method also requires a and
You can also use theoverloaded method of the that takes a Point. DrawText also requires a and a Font.
The following illustration shows the output of text drawn at a specified point when you use the DrawString overloaded method.
To draw a line of text with GDI+
Use the DrawString method, passing the text you want, Point or PointF, Font, and Brush.
To draw a line of text with GDI
Use the DrawText method, passing the text you want, Point, Font, and Color.
Compiling the Code
The previous examples require:
e, which is a parameter of .