Share via


Graphics::D rawClosedCurve (constPen*,constPointF*,INT,REAL) 方法 (gdiplusgraphics.h)

Graphics::D rawClosedCurve方法會繪製封閉的基數曲線。

語法

Status DrawClosedCurve(
  [in] const Pen    *pen,
  [in] const PointF *points,
  [in] INT          count,
  [in] REAL         tension
);

參數

[in] pen

類型:const Pen*

用來繪製封閉基數曲線的手寫筆指標。

[in] points

類型:const PointF*

PointF物件的陣列指標,指定封閉基數曲線的座標。 PointF物件的陣列必須至少包含三個專案。

[in] count

類型: INT

整數,指定 陣列中的專案數目。

[in] tension

類型: REAL

實數,指定曲線透過封閉基數曲線座標的彎曲程度。

傳回值

類型: 狀態

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

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

備註

每個結束點都是下一個基數曲線的起點。 在封閉的基數曲線中,曲線會繼續在 陣列的最後一個點,並與陣列中的第一個點連接。

範例

下列範例會繪製封閉的基數曲線。


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

   // Define a Pen object and an array of PointF objects.
   Pen greenPen(Color(255, 0, 0, 255), 3);
   PointF point1(100.0f, 100.0f);
   PointF point2(200.0f, 50.0f);
   PointF point3(400.0f, 10.0f);
   PointF point4(500.0f, 100.0f);
   PointF point5(600.0f, 200.0f);
   PointF point6(700.0f, 400.0f);
   PointF point7(500.0f, 500.0f);

   PointF curvePoints[7] = {
      point1,
      point2,
      point3,
      point4,
      point5,
      point6,
      point7};

   // Draw the closed curve.
   graphics.DrawClosedCurve(&greenPen, curvePoints, 7, 1.0);

   // Draw the points in the curve.
   SolidBrush redBrush(Color(255, 255, 0, 0));
   graphics.FillEllipse(&redBrush, Rect(95, 95, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(495, 95, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(495, 495, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(195, 45, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(395, 5, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(595, 195, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(695, 395, 10, 10));
}

需求

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

另請參閱

基本曲線

DrawCurve 方法

繪製基數曲線

FillClosedCurve 方法

圖形

PointF