Help Center

CGpHatchBrush.GetHatchStylemethod

Gets the hatch style of this hatch brush.

GraphicsmethodCGpBrush.incdocumented

Syntax

FUNCTION GetHatchStyle () AS HatchStyle

Return value

This method returns the hatch style, which is one of the elements of the HatchStyle enumeration.

Description

Gets the hatch style of this hatch brush.

Example

' ======================================================================================== ' The following example sets up two hatch styles: horiz and current (initialized to ' HatchStyleDiagonalCross). A rectangle that uses horiz as the hatch style is painted. ' Then the HatchBrush.GetHatchStyle method is used to get the current hatch style of the ' brush (which at the time is HatchStyleHorizontal). The address of the current HatchStyle ' object (initialized to HatchStyleDiagonalCross) is passed as the return point for the ' call to GetHatchStyle. When the rectangle is painted again, notice that the hatch style ' is again HatchStyleHorizontal (not HatchStyleDiagonalCross). This shows that the call to ' HatchBrush.GetHatchStyle was successful. ' ======================================================================================== SUB Example_HatchBrushGetHatchStyle (BYVAL hdc AS HDC)

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

' // Set and then draw the first hatch style. DIM brush AS CGpHatchBrush = CGpHatchBrush(HatchStyleHorizontal, ARGB_Blue, ARGB_Turquoise) graphics.FillRectangle(@brush, 20, 20, 100, 50)

' // Get the current hatch style of the brush. DIM currentStyle AS HatchStyle = brush.GetHatchStyle

' // Draw the rectangle again using the current hatch style. DIM brush2 AS CGpHatchBrush = CGpHatchBrush(currentStyle, ARGB_Blue, ARGB_Turquoise) graphics.FillRectangle(@brush2, 130, 20, 100, 50)

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

Reference

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