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

Region::IsVisible 方法會判斷某個點是否在此區域內。

語法

BOOL IsVisible(
  [in, ref] const Point &  point,
  [in]      const Graphics *g
);

參數

[in, ref] point

類型: const Point

要測試之點的參考。

[in] g

類型: const 圖形*

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

傳回值

類型: BOOL

如果點在此區域內,這個方法會傳回 TRUE;否則會傳回 FALSE

備註

注意 區域包含其框線。
 

範例

下列範例會從路徑建立區域,然後測試以判斷某個點是否位於該區域中。

VOID Example_IsVisiblePoint(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 a point is in the region.
   Point testPoint(125, 30);

   if(pathRegion.IsVisible(testPoint, &graphics))
   {
      // The test point is in the region.
   }

   // Fill a small circle centered at the test point.
   SolidBrush brush(Color(255, 0, 0, 0));
   graphics.FillEllipse(&brush, testPoint.X - 4, testPoint.Y - 4, 8, 8);
}

規格需求

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

另請參閱

圖形

區域

狀態