ToolStripItemTextRenderEventArgs.TextColor プロパティ

定義

ToolStripItem テキストの色を取得または設定します。

public:
 property System::Drawing::Color TextColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public System.Drawing.Color TextColor { get; set; }
member this.TextColor : System.Drawing.Color with get, set
Public Property TextColor As Color

プロパティ値

Color テキストの色を表す ToolStripItem

次のコード例では、このメンバーの使用方法を示します。 この例では、イベント ハンドラーがイベントの ToolStripRenderer.RenderItemText 発生を報告します。 このレポートは、イベントが発生したタイミングを知るのに役立ち、デバッグに役立ちます。

コード例を実行するには、 や ToolStripProfessionalRendererなどToolStripSystemRenderer、 からToolStripRenderer継承する型のインスタンスを含むプロジェクトに貼り付けます。 次に、インスタンス ToolStripRenderer1 に名前を付け、イベント ハンドラーがイベントに 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

適用対象