CGpGraphicsPath.AddStringmethod
Adds the outline of a string to this path.
Syntax
FUNCTION AddString (BYVAL pwszString AS WSTRING PTR, BYVAL length AS INT_, BYVAL pFamily AS CGpFontFamily PTR, BYVAL style AS INT_, BYVAL emSize AS SINGLE, BYVAL layoutRect AS GpRectF PTR, BYVAL pFormat AS CGpStringFormat PTR) AS GpStatus
FUNCTION AddString (BYVAL pwszString AS WSTRING PTR, BYVAL length AS INT_, BYVAL pFamily AS CGpFontFamily PTR, BYVAL style AS INT_, BYVAL emSize AS SINGLE, BYVAL layoutRect AS GpRect PTR, BYVAL pFormat AS CGpStringFormat PTR) AS GpStatus
FUNCTION AddString (BYVAL pwszString AS WSTRING PTR, BYVAL length AS INT_, BYVAL pFamily AS CGpFontFamily PTR, BYVAL style AS INT_, BYVAL emSize AS SINGLE, BYVAL layoutRect AS GpPointF PTR, BYVAL pFormat AS CGpStringFormat PTR) AS GpStatus
FUNCTION AddString (BYVAL pwszString AS WSTRING PTR, BYVAL length AS INT_, BYVAL pFamily AS CGpFontFamily PTR, BYVAL style AS INT_, BYVAL emSize AS SINGLE, BYVAL layoutRect AS GpPoint PTR, BYVAL pFormat AS CGpStringFormat PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
pwszString | Pointer to a wide-character string. | |
pFamily | Pointer to a FontFamily object that specifies the font family for the string. | |
style | 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 OR FontStyleUnderline OR FontStyleStrikeout sets the style as a combination of the three styles. | |
emSize | The em size, in world units, of the string characters. | |
layoutRect | Reference to a GpRectF or GpRect object that specifies, in world units, the bounding rectangle for the string. | |
pFormat | Pointer to a StringFormat object that specifies layout information (alignment, trimming, tab stops, and the like) for the string. |
Return value
If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.
If the function fails, it returns one of the other elements of the GpStatus enumeration.
Description
Adds the outline of a string to this path.
Remarks
Note that GDI+ does not support PostScript fonts or OpenType fonts which do not have TrueType outlines.
Example
' ======================================================================================== ' The following example creates a GraphicsPath object path, adds a NULL-terminated string ' to path, and then draws path. ' ======================================================================================== SUB Example_AddString (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
DIM fontFamily AS CGpFontFamily = "Times New Roman" DIM path AS CGpGraphicsPath DIM rc AS GpRect = (50, 50, 150, 100) path.AddString("Hello World", -1, @fontFamily, FontStyleRegular, 48, @rc, NULL)
' // Draw the path DIM pen AS CGpPen = ARGB_RED graphics.DrawPath(@pen, @path)
END SUB ' ========================================================================================
Reference
- Include file
CGpPath.inc - Defined in AfxNova/CGpPath.inc:451
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class