GraphicsPath オブジェクトの末尾に、結ばれた一連の線分を追加します。
Overloads Public Sub AddLines( _
ByVal points() As Point _)
[C#]
public void AddLines(Point[] points);
[C++]
public: void AddLines(Pointpoints[]);
[JScript]
public function AddLines(
points : Point[]);
パラメータ
- points
追加する線分を定義する複数の点を表す Point 構造体の配列。
解説
図形の中に前回描画された直線や曲線がある場合、前の線分の終了点と直線の開始点を結ぶ直線が追加されます。 points パラメータでは、終了点の配列が指定されます。最初の 2 つによって最初の直線が指定されます。それ以降の各点によって、前の直線の終了点を開始点とする線分の終了点が指定されます。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- 三角形を記述する 4 点の配列を作成します。
- パスを作成し、直線の配列を追加します。
- 画面にパスを描画します。
[Visual Basic, C#] 最初の点以降の各直線は前の点を開始点として使用し、新しい点を終了点として使用します。
Public Sub AddLinesExample(e As PaintEventArgs)
'Create a symetrical triangle using an array of points.
Dim myArray As Point() = {New Point(30, 30), New Point(60, 60), _
New Point(0, 60), New Point(30, 30)}
Dim myPath As New GraphicsPath()
myPath.AddLines(myArray)
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
[C#]
private void AddLinesExample(PaintEventArgs e)
{
// Create a symetrical triangle using an array of points.
Point[] myArray =
{
new Point(30,30),
new Point(60,60),
new Point(0,60),
new Point(30,30)
};
//Create a path and add lines.
GraphicsPath myPath = new GraphicsPath();
myPath.AddLines(myArray);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
GraphicsPath クラス | GraphicsPath メンバ | System.Drawing.Drawing2D 名前空間 | GraphicsPath.AddLines オーバーロードの一覧