The SetBrushOrgEx function sets the brush origin that GDI assigns to the next brush an application selects into the specified device context.
BOOL SetBrushOrgEx(
HDC hdc, // handle of device context
int nXOrg, // x-coordinate of new origin
int nYOrg, // y-coordinate of new origin
LPPOINT lppt // points to previous brush origin
);
This parameter can be NULL if the previous brush origin is not required.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Windows NT: To get extended error information, call GetLastError.
A brush is a bitmap that the system uses to paint the interiors of filled shapes.
The brush origin is a pair of coordinates specifying the location of one pixel in the bitmap. The default brush origin coordinates are (0,0). For horizontal coordinates, the value 0 corresponds to the leftmost column of pixels; the width corresponds to the rightmost column. For vertical coordinates, the value 0 corresponds to the uppermost row of pixels; the height corresponds to the lowermost row.
The system automatically tracks the origin of all window-managed device contexts and adjusts their brushes as necessary to maintain an alignment of patterns on the surface. The brush origin that is set with this call is relative to the upper-left corner of the client area.
An application should call SetBrushOrgEx after setting the bitmap stretching mode to HALFTONE via SetStretchBltMode. This must be done to avoid brush misalignment.
Windows NT: The system automatically tracks the origin of all window-managed device contexts and adjusts their brushes as necessary to maintain an alignment of patterns on the surface.
Windows 95 and Windows 98: Automatic tracking of the brush origin is not supported. Applications must use the UnrealizeObject, SetBrushOrgEx, and SelectObject functions to align the brush before using it.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in wingdi.h.
Import Library: Use gdi32.lib.
Brushes Overview, Brush Functions, GetBrushOrgEx, POINT, SelectObject, SetStretchBltMode, UnrealizeObject