ToolStripItemTextRenderEventArgs.TextFont Propriété
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.
Obtient ou définit la police du texte dessiné sur le ToolStripItem.
public:
property System::Drawing::Font ^ TextFont { System::Drawing::Font ^ get(); void set(System::Drawing::Font ^ value); };
public System.Drawing.Font TextFont { get; set; }
member this.TextFont : System.Drawing.Font with get, set
Public Property TextFont As Font
Valeur de propriété
Le Font texte dessiné sur le ToolStripItem.
Exemples
L’exemple de code suivant illustre l’utilisation de ce membre. Dans l’exemple, un gestionnaire d’événements signale l’occurrence de l’événement ToolStripRenderer.RenderItemText . Ce rapport vous aide à apprendre quand l’événement se produit et peut vous aider à déboguer.
Pour exécuter l’exemple de code, collez-le dans un projet qui contient une instance d’un type qui hérite ToolStripRenderer, par exemple un ToolStripSystemRenderer ou ToolStripProfessionalRenderer. Nommez ensuite l’instance ToolStripRenderer1 et vérifiez que le gestionnaire d’événements est associé à l’événement ToolStripRenderer.RenderItemText .
private void ToolStripRenderer1_RenderItemText(Object sender, ToolStripItemTextRenderEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Text", e.Text );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextColor", e.TextColor );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextFont", e.TextFont );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextRectangle", e.TextRectangle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextFormat", e.TextFormat );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextDirection", e.TextDirection );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Item", e.Item );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ToolStrip", e.ToolStrip );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RenderItemText Event" );
}
Private Sub ToolStripRenderer1_RenderItemText(sender as Object, e as ToolStripItemTextRenderEventArgs) _
Handles ToolStripRenderer1.RenderItemText
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "Text", e.Text)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextColor", e.TextColor)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextFont", e.TextFont)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextRectangle", e.TextRectangle)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextFormat", e.TextFormat)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextDirection", e.TextDirection)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Item", e.Item)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ToolStrip", e.ToolStrip)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"RenderItemText Event")
End Sub