Skip to content

Latest commit

 

History

History
91 lines (64 loc) · 2.63 KB

GdipMeasureString.md

File metadata and controls

91 lines (64 loc) · 2.63 KB

Home

Function name : GdipMeasureString

Group: GDI+ Text - Library: gdiplus


Measures the extent of the string in the specified font, format, and layout rectangle.


Code examples:

Custom GDI+ class

Declaration:

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
)  

FoxPro declaration:

DECLARE INTEGER GdipMeasureString IN gdiplus;
	INTEGER graphics,;
	STRING utxt,;
	INTEGER length,;
	INTEGER fnt,;
	STRING @layoutRect,;
	INTEGER stringFormat,;
	STRING @boundingBox,;
	INTEGER @codepointsFitted,;
	INTEGER @linesFilled  

Parameters:

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.


Return value:

If the method succeeds, it returns OK (0).


Comments:

Read Doug Hennig"s article Forget TXTWIDTH - use GdipMeasureString.

See also: GetTextExtentPoint32, FONTMETRICS(), TXTWIDTH(), WFONT( )