Graphics::D rawLine(constPen*,REAL,REAL,REAL,REAL) メソッド (gdiplusgraphics.h)

Graphics::D rawLine メソッドは、2 つの点を結ぶ線を描画します。

構文

Status DrawLine(
  const Pen *pen,
  REAL      x1,
  REAL      y1,
  REAL      x2,
  REAL      y2
);

パラメーター

pen

線の描画に使用されるペンへのポインター。

x1

線の始点の x 座標を指定する実数。

y1

直線の始点の y 座標を指定する実数。

x2

線の終点の x 座標を指定する実数。

y2

線の終点の y 座標を指定する実数。

戻り値

メソッドが成功した場合は、Status 列挙の要素である Ok を返します

メソッドが失敗した場合は、 Status 列挙体の他の要素のいずれかを返します。

解説

次の例では、線を描画します。

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

   // Create a Pen object.
   Pen blackPen(Color(255, 0, 0, 0), 3);

   // Initialize the coordinates of the points that define the line.
   REAL x1 = 100.0f;
   REAL y1 = 100.0f;
   REAL x2 = 500.0f;
   REAL y2 = 100.0f;

   // Draw the line.
   graphics.DrawLine(&blackPen, x1, y1, x2, y2);
}

必要条件

   
Header gdiplusgraphics.h

関連項目

DrawLines メソッド

グラフィックス

ペン、直線、および四角形

Pointf

ペンを使用した直線と四角形の描画