GraphicsPath::IsOutlineVisible (constPointF&,constPen*,constGraphics*) 方法 (gdipluspath.h)

GraphicsPath::IsOutlineVisible 方法會決定當指定的 Graphics 物件和指定的手寫筆繪製路徑時,指定的點是否會觸碰此路徑的外框。

語法

BOOL IsOutlineVisible(
  const PointF & point,
  const Pen      *pen,
  const Graphics *g
);

參數

point

要測試之點的參考。

pen

Pen 物件的指標。 這個方法會決定測試點是否觸碰此手寫筆所繪製的路徑外框。 更多點會觸碰寬畫筆所繪製的外框,而不是觸碰窄畫筆所繪製的外框。

g

選擇性。 指定世界對裝置轉換之 Graphics 物件的指標。 如果此參數的值是 NULL,則會以世界座標完成測試;否則,測試會在裝置座標中完成。 預設值是 NULL

傳回值

如果測試點觸碰此路徑的大綱,這個方法會傳回 TRUE;否則會傳回 FALSE

備註

範例

下列範例會建立橢圓形路徑,並使用寬黃色畫筆繪製該路徑。 然後,程式代碼會測試陣列中的每個點,以查看點是否觸碰外框 (,因為它是由路徑的寬黃色畫筆) 繪製。 觸碰外框的點會繪製綠色,而不會觸控外框的點會繪製紅色。

VOID Example_IsOutlineVisibleExample(HDC hdc)
{
   Graphics graphics(hdc);

   INT j;
   Pen yellowPen(Color(255, 255, 255, 0), 20);
   SolidBrush brush(Color(255, 255, 0,  0));

   // Create and draw a path.
   GraphicsPath path;
   path.AddEllipse(50, 50, 200, 100);
   graphics.DrawPath(&yellowPen, &path);

   // Create an array of three points, and determine whether each
   // point in the array touches the outline of the path.
   // If a point touches the outline, paint it green.
   // If a point does not touch the outline, paint it red.
   PointF[] = {
      PointF(230, 138),
      PointF(100, 120),
      PointF(150, 170)};

   for(j = 0; j <= 2; ++j)
   {
      if(path.IsOutlineVisible(points[j], &yellowPen, NULL))
         brush.SetColor(Color(255, 0, 255,  0));
      else
         brush.SetColor(Color(255, 255, 0,  0));

      graphics.FillEllipse(&brush, points[j].X - 3.0f, points[j].Y - 3.0f, 6.0f, 6.0f);
   }
}

Color(255, 255, 0,  0)Color(255, 255, 0,  0)

規格需求

   
標頭 gdipluspath.h

另請參閱

使用區域裁剪

建構和繪製路徑

建立路徑漸層

圖形

GraphicsPath

IsOutlineVisible 方法

IsVisible 方法

路徑

畫筆、線條和矩形

PointF

設定畫筆寬度和對齊方式