Group: GDI+ Text - Library: gdiplus
GpStatus WINGDIPAPI GdipMeasureString(
GpGraphics *graphics,
GDIPCONST WCHAR *string,
INT length,
GDIPCONST GpFont *font,
GDIPCONST RectF *layoutRect,
GDIPCONST GpStringFormat *stringFormat,
RectF *boundingBox,
INT *codepointsFitted,
INT *linesFilled
)
DECLARE INTEGER GdipMeasureString IN gdiplus;
INTEGER graphics,;
STRING utxt,;
INTEGER length,;
INTEGER fnt,;
STRING @layoutRect,;
INTEGER stringFormat,;
STRING @boundingBox,;
INTEGER @codepointsFitted,;
INTEGER @linesFilled
graphics [in] Pointer to a Graphics object.
string [in] Pointer to a wide-character string to be measured.
length [in] Integer that specifies the number of characters in the string array. The length parameter can be set to ?1 if the string is null terminated.
font [in] Pointer to a Font object that specifies the family name, size, and style of the font that is applied to the string.
layoutRectSize [in] Reference to a SizeF object that specifies the width and height of a rectangle that bounds the string.
stringFormat [in] Pointer to a StringFormat object that specifies the layout information, such as alignment, trimming, tab stops, and so forth.
size [out] Pointer to a SizeF object that receives the width and height of the rectangle that bounds the string.
codepointsFitted [out] Optional. Pointer to an INT that receives the number of characters that actually fit into the layout rectangle. The default value is a NULL pointer.
linesFilled [out] Optional. Pointer to an INT that receives the number of lines that actually fit into the layout rectangle. The default value is a NULL pointer.
If the method succeeds, it returns OK (0).
Read Doug Hennig"s article Forget TXTWIDTH - use GdipMeasureString.
See also: GetTextExtentPoint32, FONTMETRICS(), TXTWIDTH(), WFONT( )