GraphicsPath.AddPath(GraphicsPath, Boolean) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定された GraphicsPath をこのパスに追加します。
public:
void AddPath(System::Drawing::Drawing2D::GraphicsPath ^ addingPath, bool connect);
public void AddPath (System.Drawing.Drawing2D.GraphicsPath addingPath, bool connect);
member this.AddPath : System.Drawing.Drawing2D.GraphicsPath * bool -> unit
Public Sub AddPath (addingPath As GraphicsPath, connect As Boolean)
パラメーター
- addingPath
- GraphicsPath
追加する GraphicsPath。
- connect
- Boolean
追加されたパスの最初の図形が、このパスの最後の図形の一部になるかどうかを指定する Boolean 値。 値が true
の場合は、追加されたパスの最初の図形が、このパスの最後の図形の一部になります (可能な場合)。 値が false
の場合は、追加されたパスの最初の図形が、このパスの最後の図形から分離されます。
例
次のコード例は、Windows フォームで使用するように設計されており、イベント オブジェクトがOnPaint必要PaintEventArgse
です。 コードは、次のアクションを実行します。
2 つのパスを 1 つの右辺の三角形、もう 1 つは上向きの三角形を作成します。
2 番目のパスを最初のパスに追加します。
結果のパスを画面に描画します。
private:
void AddPathExample( PaintEventArgs^ e )
{
// Create the first pathright side up triangle.
array<Point>^ myArray = {Point(30,30),Point(60,60),Point(0,60),Point(30,30)};
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddLines( myArray );
// Create the second pathinverted triangle.
array<Point>^ myArray2 = {Point(30,30),Point(0,0),Point(60,0),Point(30,30)};
GraphicsPath^ myPath2 = gcnew GraphicsPath;
myPath2->AddLines( myArray2 );
// Add the second path to the first path.
myPath->AddPath( myPath2, true );
// Draw the combined path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
private void AddPathExample(PaintEventArgs e)
{
// Create the first pathright side up triangle.
Point[] myArray =
{
new Point(30,30),
new Point(60,60),
new Point(0,60),
new Point(30,30)
};
GraphicsPath myPath = new GraphicsPath();
myPath.AddLines(myArray);
// Create the second pathinverted triangle.
Point[] myArray2 =
{
new Point(30,30),
new Point(0,0),
new Point(60,0),
new Point(30,30)
};
GraphicsPath myPath2 = new GraphicsPath();
myPath2.AddLines(myArray2);
// Add the second path to the first path.
myPath.AddPath(myPath2,true);
// Draw the combined path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddPathExample(ByVal e As PaintEventArgs)
' Creates a symetrical triangle and adds an inverted triangle.
' Create the first path - right side up triangle.
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)
' Create the second path - inverted triangle.
Dim myArray2 As Point() = {New Point(30, 30), New Point(0, 0), _
New Point(60, 0), New Point(30, 30)}
Dim myPath2 As New GraphicsPath
myPath2.AddLines(myArray2)
' Add the second path to the first path.
myPath.AddPath(myPath2, True)
' Draw the combined path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub