Help Center

CGpPen.SetBrushmethod

Sets the **Brush** object that a pen uses to fill a line.

GraphicsmethodCGpPen.incdocumented

Syntax

FUNCTION SetBrush (BYVAL pBrush AS CGpBrush PTR) AS GpStatus

Parameters

NameDescription
pBrushPointer to a Brush object for the pen to use to fill a 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 Brush object that a pen uses to fill a line.

Example

' ======================================================================================== ' The following example creates a HatchBrush object and then passes the address of that ' HatchBrush object to a Pen constructor. The code then sets the brush for the pen and ' draws a line. ' ======================================================================================== SUB Example_SetBrush (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 HatchBrush object DIM hatchBrush AS CGpHatchBrush = CGpHatchBrush(HatchStyleVertical, ARGB_RED, ARGB_BLUE)

' // Create a pen, and set the brush for the pen DIM pen AS CGpPen = CGpPen(ARGB_RED, 10) pen.SetBrush(@hatchBrush)

' // Draw a line with the pen graphics.DrawLine(@pen, 0, 0, 200, 100)

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

Reference

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