Region::IsVisible 方法确定某个点是否在此区域内。
语法
BOOL IsVisible(
  INT            x,
  INT            y,
  const Graphics *g
);
parameters
x
指定要测试的点的 x 坐标的整数。
y
指定要测试的点的 y 坐标的整数。
g
可选。 指向 图形 对象的指针,该对象包含计算该区域和点的设备坐标所需的世界和页面转换。 默认值为 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 |