GraphicsPath::AddPolygon (constPoint*,INT) 方法 (gdipluspath.h)

GraphicsPath::AddPolygon 方法會將多邊形新增至此路徑。

語法

Status AddPolygon(
  [in] const Point *points,
  [in] INT         count
);

參數

[in] points

類型: const Point*

指定多邊形頂點之點陣列的指標。

[in] count

類型: INT

整數,指定 陣列中的項目數目。

傳回值

類型: 狀態

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

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

備註

GraphicsPath::AddPolygon 方法類似於 AddLines 方法。 差異在於多邊形是內建封閉圖,但除非您呼叫 GraphicsPath::CloseFigure,否則線條序列不是封閉圖。 當 Windows GDI+ 轉譯路徑時,該路徑中的每個多邊形都會關閉;也就是說,多邊形的最後一個頂點會透過直線連接到第一個頂點。

範例

下列範例會建立 GraphicsPath 物件 路徑、將多邊形新增至 路徑,然後繪製 路徑

VOID Example_AddPolygon(HDC hdc)
{
   Graphics graphics(hdc); 
 
   Point pts[] = {Point(20, 20),
                  Point(120, 20),
                  Point(120, 70)};

   GraphicsPath path;
   path.AddPolygon(pts, 3);

   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);
}

規格需求

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

另請參閱

AddPolygon 方法

使用區域裁剪

建構和繪製路徑

建立路徑漸層

GraphicsPath

路徑

多邊形