SetBrushOrgEx

  BOOL SetBrushOrgEx(hdc, nXOrg, nYOrg, lppt)    
  HDC hdc; /* handle of device context */
  int nXOrg; /* x-coordinate of new origin */
  int nYOrg; /* y-coordinate of new origin */
  LPPOINT lppt; /* receives previous brush origin */

The SetBrushOrgEx function specifies the origin that GDI will assign to the next brush an application selects into the specified device context.

Parameters

hdc

Identifies the device context.

nXOrg

Specifies the x-coordinate, in device units, of the new origin. This value must be in the range 0 through 7.

nYOrg

Specifies the y-coordinate, in device units, of the new origin. This value must be in the range 0 through 7.

lppt

Points to a POINT structure that receives the previous brush origin. The POINT structure has the following format:

typedef struct tagPOINT { /* pt */

LONG x;

LONG y;

} POINT;

This parameter can be NULL if the previous brush origin is not required.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

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

The brush origin is a coordinate that specifies the location of one of the pixels in the bitmap. These coordinates can be any value between 0 and 7. (For horizontal coordinates, the value 0 corresponds to the leftmost column of pixels and the value 7 corresponds to the rightmost column. For vertical coordinates, the value 0 corresponds to the topmost row of pixels and the value 7 corresponds to the bottommost row.) When Windows positions the brush at the start of any painting operation, it maps the pixel at the brush's origin to the upper-left corner of the application's client area.

Windows will automatically track the origin of all window-managed device contexts and adjust their brushes as necessary to maintain alignment of patterns on the surface. the origin set with this call is relative to the upper left corner of the client area.

The default brush origin is at the coordinate (0,0).

See Also

GetBrushOrgEx