DrawToolTipEventArgs.DrawText Method
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.
Draws the text of the ToolTip using the system text color and font, and optionally using specific formatting options.
DrawText() |
Draws the text of the ToolTip using the system text color and font. |
DrawText(TextFormatFlags) |
Draws the text of the ToolTip using the system text color and font, and the specified text layout. |
Draws the text of the ToolTip using the system text color and font.
public:
void DrawText();
public void DrawText ();
member this.DrawText : unit -> unit
Public Sub DrawText ()
Examples
The following code example demonstrates how to custom draw the ToolTip. The example creates a ToolTip and associates it to three Button controls located on the Form. The example sets the OwnerDraw property to true and handles the Draw event. In the Draw event handler, the ToolTip is custom drawn differently depending on what button the ToolTip is being displayed for as indicated by the DrawToolTipEventArgs.AssociatedControl property.
The code excerpt below demonstrates using the DrawBorder, DrawBackground, and DrawText methods. See the DrawToolTipEventArgs class overview for the complete code example.
// Draw the ToolTip using default values if the ToolTip is for button3.
else if ( e->AssociatedControl == button3 )
{
e->DrawBackground();
e->DrawBorder();
e->DrawText();
}
// Draw the ToolTip using default values if the ToolTip is for button3.
else if (e.AssociatedControl == button3)
{
e.DrawBackground();
e.DrawBorder();
e.DrawText();
}
ElseIf (e.AssociatedControl Is button3) Then
' Draw the ToolTip using default values if the ToolTip is for button3.
e.DrawBackground()
e.DrawBorder()
e.DrawText()
End If
Remarks
The DrawText() method represents the default method of displaying a ToolTip. This method uses the system specified font and the current value of SystemColors.InfoText for the font color. The text is drawn as a single line centered horizontally and vertically within the rectangle specified by the Bounds property; it is equivalent to the following call to the overloaded version of DrawText(TextFormatFlags):
DrawText(TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.HidePrefix)
See also
Applies to
.NET Framework 4.8.1 וגירסאות אחרות
מוצר | גירסאות |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Draws the text of the ToolTip using the system text color and font, and the specified text layout.
public:
void DrawText(System::Windows::Forms::TextFormatFlags flags);
public void DrawText (System.Windows.Forms.TextFormatFlags flags);
member this.DrawText : System.Windows.Forms.TextFormatFlags -> unit
Public Sub DrawText (flags As TextFormatFlags)
Parameters
- flags
- TextFormatFlags
A TextFormatFlags containing a bitwise combination of values that specifies the display and layout for the ToolTipText.
Remarks
The DrawText(TextFormatFlags) method is used to customize certain visual aspects of a ToolTip, including the layout of the ToolTip text. This method uses the system specified font and the current value of SystemColors.InfoText for the font color.
See also
Applies to
.NET Framework 4.8.1 וגירסאות אחרות
מוצר | גירסאות |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
משוב של .NET
.NET הוא פרויקט קוד פתוח. בחר קישור כדי לספק משוב: