Help Center

GdipAddPathStringfunction

Adds the outline of a string to this path.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipAddPathString (BYVAL path AS GpPath PTR, BYVAL string AS CONST WSTRING PTR, BYVAL length AS INT_, BYVAL family AS CONST GpFontFamily PTR, BYVAL style AS INT_, BYVAL emSize AS REAL, BYVAL layoutRect AS CONST GpRectF PTR, BYVAL format AS CONST GpStringFormat PTR) AS GpStatus
Also documented as GdipAddPathStringI — one description covers them all.

Parameters

NameDescription
path[in] Pointer to the GraphicsPath object.
string[in] Pointer to a wide-character string.
length[in] Long integer value 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.
family[in] Pointer to a GpFontFamily object that specifies the font family for the string.
style[in] Long integer value 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[in] Simple precision value that specifies the em size, in world units, of the string characters.
layoutRect[in] Reference to a GpRect structure that specifies, in world units, the bounding rectangle for the string.
format[in] Pointer to a StringFormat object that specifies layout information (alignment, trimming, tab stops, and the like) for the string.

Description

Adds the outline of a string to this path.

Example

' ======================================================================================== ' This example adds the outline of a string to a GraphicsPath using GdipAddPathString. ' ======================================================================================== SUB Example_DrawPathString (BYVAL hdc AS HDC)

DIM hStatus AS LONG

' // Create a graphics object from the device context DIM graphics AS GpGraphics PTR hStatus = GdipCreateFromHDC(hdc, @graphics)

' // Get the DPI scaling ratios DIM dpiX AS SINGLE hStatus = GdipGetDpiX(graphics, @dpiX) DIM rxRatio AS SINGLE = dpiX / 96 DIM dpiY AS SINGLE hStatus = GdipGetDpiY(graphics, @dpiY) Dim ryRatio AS SINGLE = dpiY / 96 ' // Set the scale transform hStatus = GdipScaleWorldTransform(graphics, rxRatio, ryRatio, MatrixOrderPrepend)

' // Create GraphicsPath DIM path AS GpPath PTR hStatus = GdipCreatePath(FillModeAlternate, @path)

' // Define font family DIM fontFamily AS GpFontFamily PTR hStatus = GdipCreateFontFamilyFromName("Arial", NULL, @fontFamily)

' // Define layout rectangle DIM layout AS GpRectF = (90, 90, 300, 100)

' // Add string to path DIM text AS WSTRING * 32 = "Hello, GDI+!" DIM style AS LONG = FontStyleRegular DIM emSize AS SINGLE = 36 hStatus = GdipAddPathString(path, @text, -1, fontFamily, style, emSize, @layout, NULL)

' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_DARKRED, 2, UnitWorld, @pen)

' // Draw path hStatus = GdipDrawPath(graphics, pen, path)

' // Cleanup IF pen THEN GdipDeleteBrush(pen) IF fontFamily THEN GdipDeleteFontFamily(fontFamily) IF path THEN GdipDeletePath(path) IF graphics THEN GdipDeleteGraphics(graphics)

END SUB ' ========================================================================================

Reference

  • Defined in AfxNova/AfxGdiPlus.bi:2024
  • Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
  • Topic: GraphicsPath Functions