InvertRgn

2.x

  BOOL InvertRgn(hdc, hrgn)    
  HDC hdc; /* handle of device context */
  HRGN hrgn; /* handle of region, */  

The InvertRgn function inverts the colors in a given region.

Parameters

hdc

Identifies the device context.

hrgn

Identifies the region for which colors are to be inverted.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Comments

On monochrome screens, the InvertRgn function makes white pixels black and black pixels white. On color screens, the inversion depends on how the colors are generated for the screen.

Example

The following example sets the device coordinates of and creates a rectangular region, selects the region into a device context, and then calls the InvertRgn function to display the region in inverted colors:

HRGN hrgn;

hrgn = CreateRectRgn(10, 10, 110, 110);
SelectObject(hdc, hrgn);
InvertRgn(hdc, hrgn);

DeleteObject(hrgn);

See Also

FillRgn, PaintRgn