Export (0) Print
Expand All

DrawToolTipEventArgs Class

Provides data for the ToolTip.Draw event.

System.Object
  System.EventArgs
    System.Windows.Forms.DrawToolTipEventArgs

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

type DrawToolTipEventArgs =  
    class 
        inherit EventArgs 
    end

The DrawToolTipEventArgs type exposes the following members.

  NameDescription
Public methodDrawToolTipEventArgsInitializes a new instance of the DrawToolTipEventArgs class.
Top

  NameDescription
Public propertyAssociatedControlGets the control for which the ToolTip is being drawn.
Public propertyAssociatedWindowGets the window to which this ToolTip is bound.
Public propertyBoundsGets the size and location of the ToolTip to draw.
Public propertyFontGets the font used to draw the ToolTip.
Public propertyGraphicsGets the graphics surface used to draw the ToolTip.
Public propertyToolTipTextGets the text for the ToolTip that is being drawn.
Top

  NameDescription
Public methodDrawBackgroundDraws the background of the ToolTip using the system background color.
Public methodDrawBorderDraws the border of the ToolTip using the system border color.
Public methodDrawText()Draws the text of the ToolTip using the system text color and font.
Public methodDrawText(TextFormatFlags)Draws the text of the ToolTip using the system text color and font, and the specified text layout.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The ToolTip.Draw event is raised by the ToolTip class when the ToolTip is drawn and the ToolTip.OwnerDraw property value is true. The handler for this event receives a parameter of type DrawToolTipEventArgs. The DrawToolTipEventArgs class contains all the information needed to paint the ToolTip, including the ToolTip text, the Rectangle, and the Graphics object on which the drawing should be done. To customize the look of the ToolTip, use the Rectangle to determine the bounds of the ToolTip, and the Graphics object to perform your customized drawing. You can increase the bounds of the ToolTip before it is shown by handling the Popup event.

DrawToolTipEventArgs also supports partial customization through the DrawBackground, DrawText and DrawBorder methods. Using these methods, you can owner draw portions of the ToolTip while leaving the other portions drawn in the standard way.

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.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.3, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft