GraphicsPath.Widen Méthode

Définition

Remplace ce chemin par des courbes qui entourent la zone remplie lorsque ce chemin est dessiné par le stylet spécifié.

Surcharges

Nom Description
Widen(Pen)

Ajoute un plan supplémentaire au chemin d’accès.

Widen(Pen, Matrix)

Ajoute un plan supplémentaire au GraphicsPath.

Widen(Pen, Matrix, Single)

Remplace cette GraphicsPath par des courbes qui entourent la zone remplie lorsque ce chemin est dessiné par le stylet spécifié.

Widen(Pen)

Ajoute un plan supplémentaire au chemin d’accès.

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)

Paramètres

pen
Pen

Valeur Pen qui spécifie la largeur entre le contour d’origine du chemin d’accès et le nouveau plan créé par cette méthode.

Exemples

Pour obtenir un exemple, consultez Widen(Pen, Matrix, Single).

Remarques

Cette méthode crée un contour autour des lignes d’origine dans ce GraphicsPath, avec une distance entre les lignes existantes et le nouveau contour égal à celui de la Pen largeur utilisée dans l’appel à Widen. Si vous souhaitez remplir l’espace entre les lignes, vous devez utiliser plutôt le FillPathDrawPath.

S’applique à

Widen(Pen, Matrix)

Ajoute un plan supplémentaire au 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);
member this.Widen : System.Drawing.Pen * System.Drawing.Drawing2D.Matrix -> unit
Public Sub Widen (pen As Pen, matrix As Matrix)

Paramètres

pen
Pen

Valeur Pen qui spécifie la largeur entre le contour d’origine du chemin d’accès et le nouveau plan créé par cette méthode.

matrix
Matrix

Qui Matrix spécifie une transformation à appliquer au chemin avant l’élargissement.

Exemples

Pour obtenir un exemple, consultez Widen(Pen, Matrix, Single).

Remarques

Cette méthode crée un contour autour des lignes d’origine dans ce GraphicsPath, avec une distance entre les lignes existantes et le nouveau contour égal à celui de la Pen largeur utilisée dans l’appel à Widen. Si vous souhaitez remplir l’espace entre les lignes, vous devez utiliser plutôt le FillPathDrawPath.

S’applique à

Widen(Pen, Matrix, Single)

Remplace cette GraphicsPath par des courbes qui entourent la zone remplie lorsque ce chemin est dessiné par le stylet spécifié.

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)

Paramètres

pen
Pen

Valeur Pen qui spécifie la largeur entre le contour d’origine du chemin d’accès et le nouveau plan créé par cette méthode.

matrix
Matrix

Qui Matrix spécifie une transformation à appliquer au chemin avant l’élargissement.

flatness
Single

Valeur qui spécifie l’aplatissement des courbes.

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms, et nécessite PaintEventArgse, un objet d’événement OnPaint. Le code effectue les actions suivantes :

  • Crée un chemin et ajoute deux points de suspension au chemin.

  • Dessine le chemin en noir.

  • Élargit le chemin d’accès.

  • Dessine le chemin en rouge.

Notez que le deuxième rendu utilise FillPath au lieu de DrawPath, et par conséquent, la figure rendue a le contour rempli.

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

Remarques

Cette méthode crée un contour autour des lignes d’origine dans ce GraphicsPath, avec une distance entre les lignes existantes et le nouveau contour égal à celui de la Pen largeur utilisée dans l’appel à Widen. Si vous souhaitez remplir l’espace entre les lignes, vous devez utiliser plutôt le FillPathDrawPath.

S’applique à