Graphics.DrawPath(Pen, GraphicsPath) メソッド
定義
GraphicsPath を描画します。Draws a GraphicsPath.
public:
void DrawPath(System::Drawing::Pen ^ pen, System::Drawing::Drawing2D::GraphicsPath ^ path);
public void DrawPath (System.Drawing.Pen pen, System.Drawing.Drawing2D.GraphicsPath path);
member this.DrawPath : System.Drawing.Pen * System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub DrawPath (pen As Pen, path As GraphicsPath)
パラメーター
- path
- GraphicsPath
描画する GraphicsPath。GraphicsPath to draw.
例外
例
次のコード例は、Windows フォームで使用するように設計されてい PaintEventArgs e
ます。これは、イベントハンドラーのパラメーターであるを必要とし Paint ます。The following code example is designed for use with Windows Forms, and it requires PaintEventArgse
, which is a parameter of the Paint event handler. コードは、次のアクションを実行します。The code performs the following actions:
グラフィックスパスオブジェクトを作成し、楕円を追加します。Creates a graphics path object and adds an ellipse to it.
黒のペンを作成します。Creates a black pen.
グラフィックスパスを画面に描画します。Draws the graphics path to the screen.
public:
void DrawPathEllipse( PaintEventArgs^ e )
{
// Create graphics path object and add ellipse.
GraphicsPath^ graphPath = gcnew GraphicsPath;
graphPath->AddEllipse( 0, 0, 200, 100 );
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// Draw graphics path to screen.
e->Graphics->DrawPath( blackPen, graphPath );
}
public void DrawPathEllipse(PaintEventArgs e)
{
// Create graphics path object and add ellipse.
GraphicsPath graphPath = new GraphicsPath();
graphPath.AddEllipse(0, 0, 200, 100);
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Draw graphics path to screen.
e.Graphics.DrawPath(blackPen, graphPath);
}
Public Sub DrawPathEllipse(ByVal e As PaintEventArgs)
' Create graphics path object and add ellipse.
Dim graphPath As New GraphicsPath
graphPath.AddEllipse(0, 0, 200, 100)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Draw graphics path to screen.
e.Graphics.DrawPath(blackPen, graphPath)
End Sub
注釈
グラフィックコンテキスト内の現在の変換は、描画される前にに適用され GraphicsPath ます。The current transformation in the graphic context is applied to the GraphicsPath before it is drawn.