ToolStripItemTextRenderEventArgs ToolStripItemTextRenderEventArgs ToolStripItemTextRenderEventArgs ToolStripItemTextRenderEventArgs Class

定义

RenderItemText 事件提供数据。Provides data for the RenderItemText event.

public ref class ToolStripItemTextRenderEventArgs : System::Windows::Forms::ToolStripItemRenderEventArgs
public class ToolStripItemTextRenderEventArgs : System.Windows.Forms.ToolStripItemRenderEventArgs
type ToolStripItemTextRenderEventArgs = class
    inherit ToolStripItemRenderEventArgs
Public Class ToolStripItemTextRenderEventArgs
Inherits ToolStripItemRenderEventArgs
继承
ToolStripItemTextRenderEventArgsToolStripItemTextRenderEventArgsToolStripItemTextRenderEventArgsToolStripItemTextRenderEventArgs

示例

下面的代码示例演示如何使用此类型。The following code example demonstrates the use of this type. 在此示例中, 事件处理程序报告RenderItemText事件的发生。In the example, an event handler reports on the occurrence of the RenderItemText event. 此报表可帮助你了解何时发生事件, 并可帮助你进行调试。This report helps you to learn when the event occurs and can assist you in debugging.

若要运行示例代码, 请将其粘贴到一个项目中, 该项目包含从ToolStripRenderer继承的类型的实例, 如ToolStripProfessionalRenderer ToolStripSystemRenderer或。To run the example code, paste it into a project that contains an instance of a type that inherits from ToolStripRenderer, such as a ToolStripSystemRenderer or ToolStripProfessionalRenderer. 然后命名该实例ToolStripRenderer1 , 并确保事件处理程序RenderItemText与事件相关联。Then name the instance ToolStripRenderer1 and ensure that the event handler is associated with the RenderItemText event.

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

构造函数

ToolStripItemTextRenderEventArgs(Graphics, ToolStripItem, String, Rectangle, Color, Font, ContentAlignment) ToolStripItemTextRenderEventArgs(Graphics, ToolStripItem, String, Rectangle, Color, Font, ContentAlignment) ToolStripItemTextRenderEventArgs(Graphics, ToolStripItem, String, Rectangle, Color, Font, ContentAlignment) ToolStripItemTextRenderEventArgs(Graphics, ToolStripItem, String, Rectangle, Color, Font, ContentAlignment)

用指定的文本和文本属性初始化 ToolStripItemTextRenderEventArgs 类的新实例。Initializes a new instance of the ToolStripItemTextRenderEventArgs class with the specified text and text properties.

ToolStripItemTextRenderEventArgs(Graphics, ToolStripItem, String, Rectangle, Color, Font, TextFormatFlags) ToolStripItemTextRenderEventArgs(Graphics, ToolStripItem, String, Rectangle, Color, Font, TextFormatFlags) ToolStripItemTextRenderEventArgs(Graphics, ToolStripItem, String, Rectangle, Color, Font, TextFormatFlags) ToolStripItemTextRenderEventArgs(Graphics, ToolStripItem, String, Rectangle, Color, Font, TextFormatFlags)

用指定的文本和文本属性格式初始化 ToolStripItemTextRenderEventArgs 类的新实例。Initializes a new instance of the ToolStripItemTextRenderEventArgs class with the specified text and text properties format.

属性

Graphics Graphics Graphics Graphics

获取用于绘制 ToolStripItem 的图形。Gets the graphics used to paint the ToolStripItem.

(Inherited from ToolStripItemRenderEventArgs)
Item Item Item Item

获取要绘制的 ToolStripItemGets the ToolStripItem to paint.

(Inherited from ToolStripItemRenderEventArgs)
Text Text Text Text

获取或设置要在 ToolStripItem 上绘制的文本。Gets or sets the text to be drawn on the ToolStripItem.

TextColor TextColor TextColor TextColor

获取或设置 ToolStripItem 文本的颜色。Gets or sets the color of the ToolStripItem text.

TextDirection TextDirection TextDirection TextDirection

获取或设置是垂直还是水平绘制文本。Gets or sets whether the text is drawn vertically or horizontally.

TextFont TextFont TextFont TextFont

获取或设置在 ToolStripItem 上绘制的文本的字体。Gets or sets the font of the text drawn on the ToolStripItem.

TextFormat TextFormat TextFormat TextFormat

获取或设置在 ToolStripItem 上绘制的文本的显示和布局信息。Gets or sets the display and layout information of the text drawn on the ToolStripItem.

TextRectangle TextRectangle TextRectangle TextRectangle

获取或设置表示文本绘制区域界限的矩形。Gets or sets the rectangle that represents the bounds to draw the text in.

ToolStrip ToolStrip ToolStrip ToolStrip

获取要绘制的 OwnerToolStripItem 属性的值。Gets the value of the Owner property for the ToolStripItem to paint.

(Inherited from ToolStripItemRenderEventArgs)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于