Region::IsVisible(INT,INT,INT,INT,constGraphics*) method (gdiplusheaders.h)

The Region::IsVisible method determines whether a rectangle intersects this region.

Syntax

BOOL IsVisible(
  [in] INT            x,
  [in] INT            y,
  [in] INT            width,
  [in] INT            height,
  [in] const Graphics *g
);

Parameters

[in] x

Type: INT

Integer that specifies the x-coordinate of the upper-left corner of the rectangle to test.

[in] y

Type: INT

Integer that specifies the y-coordinate of the upper-left corner of the rectangle to test.

[in] width

Type: INT

Integer that specifies the width of the rectangle to test.

[in] height

Type: INT

Integer that specifies the height of the rectangle to test.

[in] g

Type: const Graphics*

Optional. Pointer to a Graphics object that contains the world and page transformations required to calculate the device coordinates of this region and the rectangle. The default value is NULL.

Return value

Type: BOOL

If the rectangle intersects this region, the method returns TRUE; otherwise, it returns FALSE.

Remarks

Note  A region contains its border.
 

Examples

The following example creates a region from a path and then tests to determine whether a rectangle intersects the region.

VOID Example_IsVisibleXYWH(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)};

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

   path.AddClosedCurve(points, 6);

   // Create a region from a path.
   Region pathRegion(&path);
   graphics.FillRegion(&solidBrush, &pathRegion);

   // Check to see whether the rectangle intersects the region.
   // The rectangle has upper-left corner (65, 25), width 70, and height 30.
   if(pathRegion.IsVisible(65, 25, 70, 30, &graphics))
   {
      // All or part of the rectangle is in the region.
   }

   // Draw the rectangle.
   Pen pen(Color(255, 0, 0, 0));
   graphics.DrawRectangle(&pen, 65, 25, 70, 30);
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusheaders.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Graphics

Rect

Region