ToolStripItemTextRenderEventArgs.TextFormat Proprietà

Definizione

Ottiene o imposta le informazioni di visualizzazione e layout del testo disegnato sull'oggetto ToolStripItem.

public:
 property System::Windows::Forms::TextFormatFlags TextFormat { System::Windows::Forms::TextFormatFlags get(); void set(System::Windows::Forms::TextFormatFlags value); };
public System.Windows.Forms.TextFormatFlags TextFormat { get; set; }
member this.TextFormat : System.Windows.Forms.TextFormatFlags with get, set
Public Property TextFormat As TextFormatFlags

Valore della proprietà

Combinazione bit per bit dei TextFormatFlags valori che specificano le informazioni di visualizzazione e layout del testo disegnato.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di questo membro. Nell'esempio un gestore eventi segnala l'occorrenza dell'evento ToolStripRenderer.RenderItemText . Questo report consente di apprendere quando si verifica l'evento e di facilitare il debug.

Per eseguire il codice di esempio, incollarlo in un progetto contenente un'istanza di un tipo che eredita da ToolStripRenderer, ad esempio un ToolStripSystemRenderer oggetto o ToolStripProfessionalRenderer. Assegnare quindi un nome all'istanza ToolStripRenderer1 e assicurarsi che il gestore eventi sia associato all'evento 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

Si applica a