ToolStripItemTextRenderEventArgs.TextRectangle Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the rectangle that represents the bounds to draw the text in.
public:
property System::Drawing::Rectangle TextRectangle { System::Drawing::Rectangle get(); void set(System::Drawing::Rectangle value); };
public System.Drawing.Rectangle TextRectangle { get; set; }
member this.TextRectangle : System.Drawing.Rectangle with get, set
Public Property TextRectangle As Rectangle
Property Value
The Rectangle that represents the bounds to draw the text in.
Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the ToolStripRenderer.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 ToolStripRenderer.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
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om