InvertRect function (winuser.h)

The InvertRect function inverts a rectangle in a window by performing a logical NOT operation on the color values for each pixel in the rectangle's interior.

Syntax

BOOL InvertRect(
  [in] HDC        hDC,
  [in] const RECT *lprc
);

Parameters

[in] hDC

A handle to the device context.

[in] lprc

A pointer to a RECT structure that contains the logical coordinates of the rectangle to be inverted.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

On monochrome screens, InvertRect 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 for the same rectangle restores the display to its previous colors.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-gui-l1-1-1 (introduced in Windows 8.1)

See also

FillRect

Filled Shape Functions

Filled Shapes Overview

RECT