Graphics::MeasureString(constWCHAR*,INT,constFont*,constSizeF&,constStringFormat*,SizeF*,INT*,INT*) method (gdiplusgraphics.h)
The Graphics::MeasureString method measures the extent of the string in the specified font, format, and layout rectangle.
Syntax
Status MeasureString(
[in] const WCHAR *string,
[in] INT length,
[in] const Font *font,
[in, ref] const SizeF & layoutRectSize,
[in] const StringFormat *stringFormat,
[out] SizeF *size,
[out] INT *codepointsFitted,
[out] INT *linesFilled
);
Parameters
[in] string
Type: const WCHAR*
Pointer to a wide-character string to be measured.
[in] length
Type: INT
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.
[in] font
Type: const Font*
Pointer to a Font object that specifies the family name, size, and style of the font that is applied to the string.
[in, ref] layoutRectSize
Type: const SizeF
Reference to a SizeF object that specifies the width and height of a rectangle that bounds the string.
[in] stringFormat
Type: const StringFormat*
Pointer to a StringFormat object that specifies the layout information, such as alignment, trimming, tab stops, and so forth.
[out] size
Type: SizeF*
Pointer to a SizeF object that receives the width and height of the rectangle that bounds the string.
[out] codepointsFitted
Type: INT*
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.
[out] linesFilled
Type: INT*
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
Type: Status
If the method succeeds, it returns OK, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP, Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | gdiplusgraphics.h (include Gdiplus.h) |
Library | Gdiplus.lib |
DLL | Gdiplus.dll |
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for