Region.Complement(const Region*) method

Applies to: desktop apps only

The Region::Complement method updates this region to the portion of another region that does not intersect this region.

Syntax

Status Complement(
  [in]  const Region *region
);

Parameters

  • region [in]
    Type: const Region*

    Pointer to a Region object to use to update this Region object.

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 rectangle and a region from a path. Then the code uses the path region to update the rectangular region.

VOID Example_ComplementReg(HDC hdc)
{
   Graphics graphics(hdc);

  SolidBrush solidBrush(Color(255, 255, 0, 0));

   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;

   path.AddClosedCurve(points, 6);

   // Create a region from a rectangle.
   Region rectRegion(rect);

   // Create a region from a path.
   Region pathRegion(&path); 

   // Update the rectangular region so that it consists of all points inside
   // the path region but outside the rectangular region.
   rectRegion.Complement(&pathRegion);

   graphics.FillRegion(&solidBrush, &rectRegion);
}

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

Region

Rect

Status

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012