GraphicsPath::AddString(constWCHAR*,INT,constFontFamily*,INT,REAL,constPoint&,constStringFormat*) method (gdipluspath.h)
The GraphicsPath::AddString method adds the outlines of a string to this path.
Syntax
Status AddString(
[in] const WCHAR *string,
[in] INT length,
[in] const FontFamily *family,
[in] INT style,
[in] REAL emSize,
[in, ref] const Point & origin,
[in] const StringFormat *format
);
Parameters
[in] string
Type: const WCHAR*
Pointer to a wide-character string.
[in] length
Type: INT
Integer that specifies the number of characters to display. If the string parameter points to a NULL-terminated string, this parameter can be set to –1.
[in] family
Type: const FontFamily*
Pointer to a FontFamily object that specifies the font family for the string.
[in] style
Type: INT
Integer that specifies the style of the typeface. This value must be an element of the FontStyle enumeration or the result of a bitwise
OR applied to two or more of these elements. For example, FontStyleBold | FontStyleUnderline | FontStyleStrikeout
sets the style as a combination of the three styles.
[in] emSize
Type: REAL
Real number that specifies the em size, in world units, of the string characters.
[in, ref] origin
Type: const Point
Reference to a Point object that specifies, in world units, the location of the string.
[in] format
Type: const StringFormat*
Pointer to a StringFormat object that specifies layout information (alignment, trimming, tab stops, and the like) for the string.
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.
Remarks
Note that GDI+ does not support PostScript fonts or OpenType fonts which do not have TrueType outlines.
Examples
The following example creates a GraphicsPath object path, adds a NULL-terminated string to path, and then draws path.
VOID Example_AddString(HDC hdc)
{
Graphics graphics(hdc);
FontFamily fontFamily(L"Times New Roman");
GraphicsPath path;
path.AddString(
L"Hello World",
-1, // NULL-terminated string
&fontFamily,
FontStyleRegular,
48,
Point(50, 50),
NULL);
Pen pen(Color(255, 255, 0, 0));
graphics.DrawPath(&pen, &path);
}
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 | gdipluspath.h (include Gdiplus.h) |
Library | Gdiplus.lib |
DLL | Gdiplus.dll |