System.Drawing.Graphics.DrawString Method

Draws the specified text string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects using the formatting attributes of the specified System.Drawing.StringFormat.

Syntax

public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)

Parameters

s
String to draw.
font
System.Drawing.Font that defines the text format of the string.
brush
System.Drawing.Brush that determines the color and texture of the drawn text.
layoutRectangle
System.Drawing.RectangleF structure that specifies the location of the drawn text.
format
System.Drawing.StringFormat that specifies formatting attributes, such as line spacing and alignment, that are applied to the drawn text.

Remarks

The text represented by the s parameter is drawn inside the rectangle represented by the layoutRectangle parameter. If the text does not fit inside the rectangle, it is truncated at the nearest word, unless otherwise specified with the format parameter.

Requirements

Namespace: System.Drawing
Assembly: System.Drawing (in System.Drawing.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0