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

Related Call: InvertRgn
Category: Filled Shapes
Back to the index.


Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/i/invertrect.html