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

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

語法

BOOL IsVisible(
  INT            x,
  INT            y,
  const Graphics *g
);

參數

x

整數,指定要測試之點的 X 座標。

y

整數,指定要測試之點的 Y 座標。

g

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

傳回值

類型: 狀態

如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。

備註

範例

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

VOID Example_IsVisibleXY(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 point (125, 40) is in the region.
   INT x = 125;
   INT y = 40;
   if(pathRegion.IsVisible(x, y, &graphics))
   {

      // The point is in the region.
   }

   // Fill a small circle centered at the point (125, 40).
   SolidBrush brush(Color(255, 0, 0, 0));
   graphics.FillEllipse(&brush, x - 4, y - 4, 8, 8);
}

需求

   
標頭 gdiplusheaders.h

另請參閱

區域

Rect

狀態