InvertRect

  BOOL InvertRect(hdc, lprc)    
  HDC hdc; /* handle of device context */
  CONST RECT *lprc; /* address of structure with rectangle */

The InvertRect function inverts a rectangular area. Inversion is a logical NOT operation and flips the bits of each pixel.

Parameters

hdc

Identifies the device context.

lprc

Points to a RECT structure that contains the logical coordinates of the rectangle to be inverted. The RECT structure has the following form:

typedef struct tagRECT { /* rc */

LONG left;

LONG top;

LONG right;

LONG bottom;

} RECT;

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

On monochrome screens, the InvertRect function makes white pixels black and black pixels white. On color screens, the inversion depends on how colors are generated for the screen. Calling InvertRect twice, specifying the same rectangle, restores the display to its previous colors.

The InvertRect function compares the values of the top, bottom, left, and right members of the specified rectangle. If bottom is less than or equal to top, or if right is less than or equal to left, the function does not draw the rectangle.

See Also

FillRect