ToolStripItemTextRenderEventArgs.TextDirection 属性

定义

获取或设置是垂直还是水平绘制文本。

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

属性值

ToolStripTextDirection 值之一。

示例

下面的代码示例演示了此成员的用法。 在此示例中,事件处理程序报告事件的发生情况 ToolStripRenderer.RenderItemText 。 此报表可帮助你了解事件发生的时间,并可以帮助你进行调试。

若要运行示例代码,请将其粘贴到包含继承自 ToolStripRenderer的类型实例(如 ToolStripSystemRendererToolStripProfessionalRenderer)的项目中。 然后命名实例 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

适用于