Επεξεργασία

Κοινή χρήση μέσω


ToolStripItemTextRenderEventArgs Class

Definition

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
Inheritance
ToolStripItemTextRenderEventArgs

Examples

The following code example demonstrates the use of this type. 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.

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. 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

Constructors

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

Initializes a new instance of the ToolStripItemTextRenderEventArgs class with the specified text and text properties.

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

Initializes a new instance of the ToolStripItemTextRenderEventArgs class with the specified text and text properties format.

Properties

Graphics

Gets the graphics used to paint the ToolStripItem.

(Inherited from ToolStripItemRenderEventArgs)
Item

Gets the ToolStripItem to paint.

(Inherited from ToolStripItemRenderEventArgs)
Text

Gets or sets the text to be drawn on the ToolStripItem.

TextColor

Gets or sets the color of the ToolStripItem text.

TextDirection

Gets or sets whether the text is drawn vertically or horizontally.

TextFont

Gets or sets the font of the text drawn on the ToolStripItem.

TextFormat

Gets or sets the display and layout information of the text drawn on the ToolStripItem.

TextRectangle

Gets or sets the rectangle that represents the bounds to draw the text in.

ToolStrip

Gets the value of the Owner property for the ToolStripItem to paint.

(Inherited from ToolStripItemRenderEventArgs)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to