Help Center

CGpPen.SetLineCapmethod

Sets the cap styles for the start, end, and dashes in a line drawn with this pen.

GraphicsmethodCGpPen.incdocumented

Syntax

FUNCTION SetLineCap (BYVAL startCap AS LineCap, BYVAL endCap AS LineCap, BYVAL nDashCap AS DashCap) AS GpStatus

Parameters

NameDescription
startCapElement of the LineCap enumeration that specifies the start cap of a line.
endCapElement of the LineCap enumeration that specifies the end cap of a line.
nDashCapElement of the DashCap enumeration that specifies the start and end caps of the dashes in a dashed line.

Return value

If the function succeeds, it returns Ok, which is an element of the GpStatus enumeration.

If the function fails, it returns one of the other elements of the GpStatus enumeration.

Description

Sets the cap styles for the start, end, and dashes in a line drawn with this pen.

Example

' ======================================================================================== ' The following example creates a Pen object and sets the line caps. The code then sets ' the dash style for the pen and draws a line. ' ======================================================================================== SUB Example_SetLineCap (BYVAL hdc AS HDC)

' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi

' // Create a Pen object DIM pen AS CGpPen = CGpPen(ARGB_BLUE, 15)

' // Set line caps for the pen. pen.SetLineCap(LineCapArrowAnchor, LineCapTriangle, DashCapRound)

' // Set the dash style for the pen. pen.SetDashStyle(DashStyleDash)

' // Draw a line. graphics.DrawLine(@pen, 50, 50, 420, 200)

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

Reference

  • Include file CGpPen.inc
  • Defined in AfxNova/CGpPen.inc:88
  • Documented in Graphics/GdiPlus Classes/CGpPen Class.md
  • Topic: CGpPen Class