[]
        
(Showing Draft Content)

C1.Pdf.C1PdfDocument.DrawString

DrawString Method

DrawString(string, Font, Color, RectangleF, int, StringFormat)

Draws the specified text string in the specified rectangle with the specified Color and Font objects using the formatting attributes of the specified StringFormat object.

Declaration
public int DrawString(string text, Font font, Color color, RectangleF rc, int firstChar, StringFormat sf)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The color of the drawn text.

RectangleF rc

The rectangle structure that specifies the location of the drawn text, in points from the top left corner of the page.

int firstChar

Index of the first character that will be rendered.

StringFormat sf

StringFormat object that specifies formatting attributes applied to the drawn text.

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.

DrawString(string, Font, Color, RectangleF, int, StringFormat, float)

Draws the specified text string in the specified rectangle, with the specified Color and Font, using the formatting attributes of the specified StringFormat object and specified character width coefficient.

Declaration
public int DrawString(string text, Font font, Color color, RectangleF rc, int firstChar, StringFormat sf, float widthCoeff)
Parameters
Type Name Description
string text

The string to draw.

Font font

The Font used to draw the text.

Color color

The text color.

RectangleF rc

The rectangle specifying the location of the text, in points from the top left corner of the page.

int firstChar

The index of the first character that will be rendered.

StringFormat sf

The StringFormat object specifying the formatting attributes applied to the text.

float widthCoeff

The width coefficient applied to characters. The default is 1.0, use 2.0 for double width and so on.

Returns
Type Description
int

The index of the first character that was not rendered because it did not fit in the specified rectangle.

DrawString(string, Font, Color, RectangleF, StringFormat)

Draws the specified text string in the specified rectangle with the specified Color and Font objects using the formatting attributes of the specified StringFormat object.

Declaration
public int DrawString(string text, Font font, Color color, RectangleF rc, StringFormat sf)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The color of the drawn text.

RectangleF rc

The rectangle structure that specifies the location of the drawn text, in points from the top left corner of the page.

StringFormat sf

StringFormat object that specifies formatting attributes applied to the drawn text.

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.

Implements

DrawString(string, Font, Color, RectangleF, StringFormat, float)

Draws the specified text string in the specified rectangle with the specified Color and Font objects using the formatting attributes of the specified StringFormat object.

Declaration
public int DrawString(string text, Font font, Color color, RectangleF rc, StringFormat sf, float widthCoeff)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The color of the drawn text.

RectangleF rc

The rectangle structure that specifies the location of the drawn text, in points from the top left corner of the page.

StringFormat sf

StringFormat object that specifies formatting attributes applied to the drawn text.

float widthCoeff

The width coefficient of text characters, by default 1.0, for double width 2.0.

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.

DrawString(string, Font, Color, RectangleF, int)

Draws the specified text string in the specified rectangle with the specified Color and Font objects using the formatting attributes of the specified StringFormat object.

Declaration
public int DrawString(string text, Font font, Color color, RectangleF rc, int firstChar)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The color of the drawn text.

RectangleF rc

The rectangle structure that specifies the location of the drawn text, in points from the top left corner of the page.

int firstChar

Index of the first character that will be rendered.

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.

DrawString(string, Font, Color, RectangleF)

Draws the specified text string in the specified rectangle with the specified Color and Font objects.

Declaration
public int DrawString(string text, Font font, Color color, RectangleF rc)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The color of the drawn text.

RectangleF rc

The rectangle structure that specifies the location of the drawn text, in points from the top left corner of the page.

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.

Implements
Remarks

This overload renders strings aligned to the top left corner of the specified rectangle, wrapping text as needed within the rectangle, without clipping, and in the horizontal direction. To change any of these defaults, use the overload that allows you to specify a StringFormat parameter.

DrawString(string, Font, Color, PointF, StringFormat)

Draws the specified text string at the specified point with the specified Color and Font objects using the formatting attributes of the specified StringFormat object.

Declaration
public int DrawString(string text, Font font, Color color, PointF pt, StringFormat sf)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The object that defines the color of the drawn text.

PointF pt

The point structure that specifies the location of the drawn text, in points

StringFormat sf

StringFormat object that specifies formatting attributes applied to the drawn text.

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.

DrawString(string, Font, Color, PointF, StringFormat, float)

Draws the specified text string at the specified point with the specified Color and Font objects using the formatting attributes of the specified StringFormat object and specified width coefficient of text characters.

Declaration
public int DrawString(string text, Font font, Color color, PointF pt, StringFormat sf, float widthCoeff)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The object that defines the color of the drawn text.

PointF pt

The point structure that specifies the location of the drawn text, in points

StringFormat sf

StringFormat object that specifies formatting attributes applied to the drawn text.

float widthCoeff

The width coefficient of text characters, by default 1.0, for double width 2.0.

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.

DrawString(string, Font, Color, PointF)

Draws the specified text string at the specified point with the specified Color and Font objects.

Declaration
public int DrawString(string text, Font font, Color color, PointF pt)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The object that defines the color of the drawn text.

PointF pt

The point structure that specifies the location of the drawn text, in points from the top left corner of the page.

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.

Implements

DrawString(string, Font, Color, PointF, float)

Draws the specified text string at the specified point with the specified Color, Font objects and specified width coefficient of text characters.

Declaration
public int DrawString(string text, Font font, Color color, PointF pt, float widthCoeff = 1)
Parameters
Type Name Description
string text

String to draw.

Font font

Font object that defines the appearance and size of the drawn text.

Color color

The object that defines the color of the drawn text.

PointF pt

The point structure that specifies the location of the drawn text, in points from the top left corner of the page.

float widthCoeff

The width coefficient of text characters, by default 1.0, for double width 2.0..

Returns
Type Description
int

The index of first character that was not printed because it did not fit in the specified rectangle.