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

Region::IsVisible 方法會判斷矩形是否與這個區域交集。

語法

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

參數

[in] x

類型: INT

整數,指定要測試之矩形左上角的 X 座標。

[in] y

類型: INT

整數,指定要測試之矩形左上角的 Y 座標。

[in] width

類型: INT

整數,指定要測試之矩形的寬度。

[in] height

類型: INT

整數,指定要測試之矩形的高度。

[in] g

類型: const 圖形*

選擇性。 Graphics 物件的指標,其中包含計算此區域和矩形之裝置座標所需的世界和頁面轉換。 預設值是 NULL

傳回值

類型: BOOL

如果矩形與這個區域交集,此方法會傳回 TRUE;否則會傳回 FALSE

備註

注意 區域包含其框線。
 

範例

下列範例會從路徑建立區域,然後測試以判斷矩形是否與區域交集。

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);
}

規格需求

需求
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限桌面應用程式]
最低支援的伺服器 Windows 2000 Server [僅限桌面應用程式]
目標平台 Windows
標頭 gdiplusheaders.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

圖形

Rect

區域