GraphicsPath.Widen Method

Definition

Replaces this path with curves that enclose the area that is filled when this path is drawn by the specified pen.

Overloads

Widen(Pen, Matrix)

Adds an additional outline to the GraphicsPath.

Widen(Pen)

Adds an additional outline to the path.

Widen(Pen, Matrix, Single)

Replaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.

Widen(Pen, Matrix)

Adds an additional outline to the GraphicsPath.

public:
 void Widen(System::Drawing::Pen ^ pen, System::Drawing::Drawing2D::Matrix ^ matrix);
public void Widen (System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix matrix);
public void Widen (System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix? matrix);
member this.Widen : System.Drawing.Pen * System.Drawing.Drawing2D.Matrix -> unit
Public Sub Widen (pen As Pen, matrix As Matrix)

Parameters

pen
Pen

A Pen that specifies the width between the original outline of the path and the new outline this method creates.

matrix
Matrix

A Matrix that specifies a transform to apply to the path before widening.

Examples

For an example, see Widen(Pen, Matrix, Single).

Remarks

This method creates an outline around the original lines in this GraphicsPath, with a distance between the existing lines and the new outline equal to that of the width of the Pen used in the call to Widen. If you want to fill the space between the lines you must use the FillPath rather then the DrawPath.

Applies to

Widen(Pen)

Adds an additional outline to the path.

public:
 void Widen(System::Drawing::Pen ^ pen);
public void Widen (System.Drawing.Pen pen);
member this.Widen : System.Drawing.Pen -> unit
Public Sub Widen (pen As Pen)

Parameters

pen
Pen

A Pen that specifies the width between the original outline of the path and the new outline this method creates.

Examples

For an example, see Widen(Pen, Matrix, Single).

Remarks

This method creates an outline around the original lines in this GraphicsPath, with a distance between the existing lines and the new outline equal to that of the width of the Pen used in the call to Widen. If you want to fill the space between the lines you must use the FillPath rather then the DrawPath.

Applies to

Widen(Pen, Matrix, Single)

Replaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.

public:
 void Widen(System::Drawing::Pen ^ pen, System::Drawing::Drawing2D::Matrix ^ matrix, float flatness);
public void Widen (System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix matrix, float flatness);
public void Widen (System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix? matrix, float flatness);
member this.Widen : System.Drawing.Pen * System.Drawing.Drawing2D.Matrix * single -> unit
Public Sub Widen (pen As Pen, matrix As Matrix, flatness As Single)

Parameters

pen
Pen

A Pen that specifies the width between the original outline of the path and the new outline this method creates.

matrix
Matrix

A Matrix that specifies a transform to apply to the path before widening.

flatness
Single

A value that specifies the flatness for curves.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an OnPaint event object. The code performs the following actions:

  • Creates a path and adds two ellipses to the path.

  • Draws the path in black.

  • Widens the path.

  • Draws the path in red.

Notice that the second rendering uses FillPath instead of DrawPath, and hence the rendered figure has the outline filled.

private:
   void WidenExample( PaintEventArgs^ e )
   {
      // Create a path and add two ellipses.
      GraphicsPath^ myPath = gcnew 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 = gcnew Pen( Color::Black,10.0f );
      Matrix^ widenMatrix = gcnew Matrix;
      widenMatrix->Translate( 50, 50 );
      myPath->Widen( widenPen, widenMatrix, 1.0f );

      // Draw the widened path to the screen in red.
      e->Graphics->FillPath( gcnew SolidBrush( Color::Red ), myPath );
   }
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);
}
Public Sub WidenExample(ByVal 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, 1.0F)
    ' Sets tension for curves.
    e.Graphics.FillPath(New SolidBrush(Color.Red), myPath)
End Sub

Remarks

This method creates an outline around the original lines in this GraphicsPath, with a distance between the existing lines and the new outline equal to that of the width of the Pen used in the call to Widen. If you want to fill the space between the lines you must use the FillPath rather then the DrawPath.

Applies to