このパスを、指定されたペンでこのパスを描画するときに塗りつぶされる領域を囲む曲線に置換します。
オーバーロードの一覧
パスに追加のアウトラインを追加します。
[Visual Basic] Overloads Public Sub Widen(Pen)
[JScript] public function Widen(Pen);
GraphicsPath オブジェクトに追加のアウトラインを追加します。
[Visual Basic] Overloads Public Sub Widen(Pen, Matrix)
[JScript] public function Widen(Pen, Matrix);
GraphicsPath オブジェクトを、指定されたペンでこのパスを描画するときに塗りつぶされる領域を囲む曲線に置換します。
[Visual Basic] Overloads Public Sub Widen(Pen, Matrix, Single)
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- パスを作成し、そのパスに 2 つの楕円を追加します。
- パスを黒で描画します。
- パスの幅を拡張します。
- パスを赤で描画します。
[Visual Basic, C#] 2 番目の描画では DrawPath ではなく FillPath が使用されるため、描画された図形はアウトラインが塗りつぶされます。
[Visual Basic, C#] メモ ここでは、Widen のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
Public Sub WidenExample(e As PaintEventArgs)
Dim myPath As New GraphicsPath()
myPath.AddEllipse(0, 0, 100, 100)
myPath.AddEllipse(100, 0, 100, 100)
e.Graphics.DrawPath(Pens.Black, myPath)
Dim widenPen As New Pen(Color.Black, 10)
Dim widenMatrix As New Matrix()
widenMatrix.Translate(50, 50)
myPath.Widen(widenPen, widenMatrix, 1F) ' Sets tension for curves.
e.Graphics.FillPath(New SolidBrush(Color.Red), myPath)
End Sub
[C#]
private void WidenExample(PaintEventArgs e)
{
// Create a path and add two ellipses.
GraphicsPath myPath = new GraphicsPath();
myPath.AddEllipse(0, 0, 100, 100);
myPath.AddEllipse(100, 0, 100, 100);
// Draw the original ellipses to the screen in black.
e.Graphics.DrawPath(Pens.Black, myPath);
// Widen the path.
Pen widenPen = new Pen(Color.Black, 10);
Matrix widenMatrix = new Matrix();
widenMatrix.Translate(50, 50);
myPath.Widen(widenPen, widenMatrix, 1.0f);
// Draw the widened path to the screen in red.
e.Graphics.FillPath(new SolidBrush(Color.Red), myPath);
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
参照
GraphicsPath クラス | GraphicsPath メンバ | System.Drawing.Drawing2D 名前空間