GraphicsPath.StartFigure Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Commence une nouvelle figure sans fermer la figure en cours. Tous les nouveaux points ajoutés au tracé sont ajoutés à cette nouvelle figure.
public:
void StartFigure();
public void StartFigure ();
member this.StartFigure : unit -> unit
Public Sub StartFigure ()
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, un objet d’événementOnPaint. Le code effectue les actions suivantes :
Crée un chemin d’accès.
Ajoute deux ensembles de figures. Le premier ensemble de figures combine quatre primitives en deux figures. Le deuxième ensemble de figures combine les mêmes quatre primitives (sauf qu’elles sont décalées dans l’axe y) en trois figures.
Dessine toutes les figures à l’écran.
Notez la différence d’apparence entre les deux ensembles de figures.
public:
void StartFigureExample( PaintEventArgs^ e )
{
// Create a GraphicsPath object.
GraphicsPath^ myPath = gcnew GraphicsPath;
// First set of figures.
myPath->StartFigure();
myPath->AddArc( 10, 10, 50, 50, 0, 270 );
myPath->AddLine( Point(50,0), Point(100,50) );
myPath->AddArc( 50, 100, 75, 75, 0, 270 );
myPath->CloseFigure();
myPath->StartFigure();
myPath->AddArc( 100, 10, 50, 50, 0, 270 );
// Second set of figures.
myPath->StartFigure();
myPath->AddArc( 10, 200, 50, 50, 0, 270 );
myPath->CloseFigure();
myPath->StartFigure();
myPath->AddLine( Point(60,200), Point(110,250) );
myPath->AddArc( 50, 300, 75, 75, 0, 270 );
myPath->CloseFigure();
myPath->StartFigure();
myPath->AddArc( 100, 200, 50, 50, 0, 270 );
// Draw the path to the screen.
e->Graphics->DrawPath( gcnew Pen( Color::Black ), myPath );
}
// End StartFigureExample
public void StartFigureExample(PaintEventArgs e)
{
// Create a GraphicsPath object.
GraphicsPath myPath = new GraphicsPath();
// First set of figures.
myPath.StartFigure();
myPath.AddArc(10, 10, 50, 50, 0, 270);
myPath.AddLine(new Point(50, 0), new Point(100, 50));
myPath.AddArc(50, 100, 75, 75, 0, 270);
myPath.CloseFigure();
myPath.StartFigure();
myPath.AddArc(100, 10, 50, 50, 0, 270);
// Second set of figures.
myPath.StartFigure();
myPath.AddArc(10, 200, 50, 50, 0, 270);
myPath.CloseFigure();
myPath.StartFigure();
myPath.AddLine(new Point(60, 200), new Point(110, 250));
myPath.AddArc(50, 300, 75, 75, 0, 270);
myPath.CloseFigure();
myPath.StartFigure();
myPath.AddArc(100, 200, 50, 50, 0, 270);
// Draw the path to the screen.
e.Graphics.DrawPath(new Pen(Color.Black), myPath);
}
// End StartFigureExample
Public Sub StartFigureExample(ByVal e As PaintEventArgs)
' Create a GraphicsPath object.
Dim myPath As New GraphicsPath
' First set of figures.
myPath.StartFigure()
myPath.AddArc(10, 10, 50, 50, 0, 270)
myPath.AddLine(New Point(50, 0), New Point(100, 50))
myPath.AddArc(50, 100, 75, 75, 0, 270)
myPath.CloseFigure()
myPath.StartFigure()
myPath.AddArc(100, 10, 50, 50, 0, 270)
' Second set of figures.
myPath.StartFigure()
myPath.AddArc(10, 200, 50, 50, 0, 270)
myPath.CloseFigure()
myPath.StartFigure()
myPath.AddLine(New Point(60, 200), New Point(110, 250))
myPath.AddArc(50, 300, 75, 75, 0, 270)
myPath.CloseFigure()
myPath.StartFigure()
myPath.AddArc(100, 200, 50, 50, 0, 270)
' Draw the path to the screen.
e.Graphics.DrawPath(New Pen(Color.Black), myPath)
End Sub
Remarques
L’utilisateur doit conserver les points d’origine si nécessaire. Les points d’origine étant convertis en points de contrôle de Bézier cubiques en interne, il n’existe aucun mécanisme permettant de retourner les points d’origine.
Cette méthode démarre un nouveau sous-chemin dans le chemin d’accès. Les sous-chemins vous permettent de séparer un chemin d’accès en sections et d’utiliser la GraphicsPathIterator classe pour itérer à travers les sous-chemins.
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour