CreateHatchBrush

  HBRUSH CreateHatchBrush(fnStyle, clrref)    
  int fnStyle; /* hatch-style flag */
  COLORREF clrref; /* color value */

The CreateHatchBrush function creates a logical brush that has the hatch-pattern that is specified by fnStyle and the color that is specified by clrref.

Parameters

fnStyle

Specifies the hatch style of the brush. It can be any one of the following values:

Value Meaning

HS_BDIAGONAL 45-degree upward hatch (left to right)
HS_CROSS Horizontal and vertical crosshatch
HS_DIAGCROSS 45-degree crosshatch
HS_FDIAGONAL 45-degree downward hatch (left to right)
HS_HORIZONTAL Horizontal hatch
HS_VERTICAL Vertical hatch

clrref

Specifies the foreground color of the brush (the color of the hatches).

Return Value

The return value identifies a logical brush if the function is successful. Otherwise, it is zero.

Comments

A brush is an 8-pixel by 8-pixel bitmap that Windows uses to paint the interior of filled objects.

Once an application has created a brush by calling CreateHatchBrush, it can select that brush into any device context by calling SelectObject.

If an application uses a hatch brush to fill the backgrounds of both a parent and child window and requires that the backgrounds match, it may be necessary to set the brush origin prior to painting the background of the child window. An application can set the brush origin by calling the SetBrushOrgEx function. (An application can retrieve the current brush origin by calling the GetBrushOrgEx function.)

See Also

CreatePatternBrush, CreateSolidBrush, CreateDIBPatternBrush, CreateDIBPatternBrushPt, DeleteObject, GetBrushOrgEx, SelectObject, SetBrushOrgEx