Graphics.FillPath(Brush, GraphicsPath) 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.
Remplit l'intérieur d'un GraphicsPath.
public:
void FillPath(System::Drawing::Brush ^ brush, System::Drawing::Drawing2D::GraphicsPath ^ path);
public void FillPath (System.Drawing.Brush brush, System.Drawing.Drawing2D.GraphicsPath path);
member this.FillPath : System.Drawing.Brush * System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub FillPath (brush As Brush, path As GraphicsPath)
Paramètres
- path
- GraphicsPath
GraphicsPath qui représente le tracé à remplir.
Exceptions
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, qui est un paramètre du Paint gestionnaire d’événements. Le code effectue les actions suivantes :
Crée un pinceau rouge uni.
Crée un objet de chemin d’accès graphique.
Ajoute une ellipse au chemin d’accès graphique.
Remplit le chemin à l’écran.
public:
void FillPathEllipse( PaintEventArgs^ e )
{
// Create solid brush.
SolidBrush^ redBrush = gcnew SolidBrush( Color::Red );
// Create graphics path object and add ellipse.
GraphicsPath^ graphPath = gcnew GraphicsPath;
graphPath->AddEllipse( 0, 0, 200, 100 );
// Fill graphics path to screen.
e->Graphics->FillPath( redBrush, graphPath );
}
public void FillPathEllipse(PaintEventArgs e)
{
// Create solid brush.
SolidBrush redBrush = new SolidBrush(Color.Red);
// Create graphics path object and add ellipse.
GraphicsPath graphPath = new GraphicsPath();
graphPath.AddEllipse(0, 0, 200, 100);
// Fill graphics path to screen.
e.Graphics.FillPath(redBrush, graphPath);
}
Public Sub FillPathEllipse(ByVal e As PaintEventArgs)
' Create solid brush.
Dim redBrush As New SolidBrush(Color.Red)
' Create graphics path object and add ellipse.
Dim graphPath As New GraphicsPath
graphPath.AddEllipse(0, 0, 200, 100)
' Fill graphics path to screen.
e.Graphics.FillPath(redBrush, graphPath)
End Sub
Remarques
Un GraphicsPath se compose d’une série de segments de courbes et de courbes. Si le chemin d’accès représenté par le path
paramètre n’est pas fermé, un segment supplémentaire est ajouté à partir du dernier point au premier point pour fermer le chemin.
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