InvertRect Function

Declare Function InvertRect Lib "user32.dll" (ByVal hdc As Long, ByVal lpRect As RECT) As Long

Platforms: Win 32s, Win 95/98, Win NT

InvertRect inverts the image inside a rectangular area on a device. The inverted colors are calculated by taking the binary NOT of each pixel's RGB color value inside the rectangle. The function returns a non-zero value if successful, or 0 if an error occured.

hdc
A device context to the device to invert the colors in a given rectangle on.
lpRect
The rectangle to invert.

Example:

' Invert the colors in the rectangle (20,30)-(150,100) on window Form1.
Dim r As RECT  ' rectangle to invert
Dim retval As Long  ' return value

retval = SetRect(r, 20, 30, 150, 100)  ' set r to be (20,30)-(150,100)
retval = InvertRect(Form1.hDC, r)  ' invert the pixels within the rectangle

See Also: InvertRgn
Category: Filled Shapes

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/i/invertrect.html