Region.Xor(const Rect) method
Applies to: desktop apps only
The Region::Xor method updates this region to the nonintersecting portions of itself and the specified rectangle's interior.
Syntax
Status Xor(
[in, ref] const Rect &rect
);
Parameters
rect [in, ref]
Type: const RectReference to a rectangle to use to update this region.
Return value
Type:
Type: Status****
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Examples
The following example creates a region from a path and then uses a rectangle to update the region.
VOID Example_XorRect(HDC hdc)
{
Graphics graphics(hdc);
Point points[] = {
Point(110, 20),
Point(120, 30),
Point(100, 60),
Point(120, 70),
Point(150, 60),
Point(140, 10)};
Rect rect(65, 15, 70, 45);
GraphicsPath path;
SolidBrush solidBrush(Color(255, 255, 0, 0));
path.AddClosedCurve(points, 6);
// Create a region from a path.
Region pathRegion(&path);
// Perform an exclusive OR operation on the region and a rectangle.
pathRegion.Xor(rect);
graphics.FillRegion(&solidBrush, &pathRegion);
}
Requirements
Minimum supported client |
Windows XP, Windows 2000 Professional |
Minimum supported server |
Windows 2000 Server |
Product |
GDI+ 1.0 |
Header |
Gdiplusheaders.h (include Gdiplus.h) |
Library |
Gdiplus.lib |
DLL |
Gdiplus.dll |
See also
Send comments about this topic to Microsoft
Build date: 3/6/2012