GraphicsPath.CloseFigure 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.
Ferme la figure en cours et crée une nouvelle figure. Si la figure en cours contient une succession de lignes et de courbes connectées, la méthode ferme la boucle à l'aide d'une ligne connectant le point de terminaison au point de début.
public:
void CloseFigure();
public void CloseFigure ();
member this.CloseFigure : unit -> unit
Public Sub CloseFigure ()
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 crée un triangle en créant un chemin, en commençant une figure, en ajoutant deux lignes croisées à la figure, puis en fermant la figure pour former un triangle. Le chemin d’accès est ensuite dessiné à l’écran.
private:
void CloseFigureExample( PaintEventArgs^ e )
{
// Create a path consisting of two, open-ended lines and close
// the lines using CloseFigure.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->StartFigure();
myPath->AddLine( Point(10,10), Point(200,10) );
myPath->AddLine( Point(200,10), Point(200,200) );
myPath->CloseFigure();
// Draw the path to the screen.
e->Graphics->DrawPath( Pens::Black, myPath );
}
private void CloseFigureExample(PaintEventArgs e)
{
// Create a path consisting of two, open-ended lines and close
// the lines using CloseFigure.
GraphicsPath myPath = new GraphicsPath();
myPath.StartFigure();
myPath.AddLine(new Point(10, 10), new Point(200, 10));
myPath.AddLine(new Point(200, 10), new Point(200, 200));
myPath.CloseFigure();
// Draw the path to the screen.
e.Graphics.DrawPath(Pens.Black, myPath);
}
Public Sub CloseFigureExample(ByVal e As PaintEventArgs)
' Create a path consisting of two, open-ended lines and close
' the lines using CloseFigure.
Dim myPath As New GraphicsPath
myPath.StartFigure()
myPath.AddLine(New Point(10, 10), New Point(200, 10))
myPath.AddLine(New Point(200, 10), New Point(200, 200))
myPath.CloseFigure()
' Draw the path to the screen.
e.Graphics.DrawPath(Pens.Black, myPath)
End Sub
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