ToolTipsFactory

Object Model - Additional Properties - Font

Gets or sets a value which defines the font to be used for text displayed by the tooltip.

[Visual Basic]
Public Property Font As Font
[C#]
public Font Font {get; set;}

Property Value

An existing Font object.

Overridable

Layout-file

Property of
AnimationTT ImageTT SingleLineTT MultiLineTT

Description

This property defines the font to be used for the text displayed by the tooltip component. Usually the font to be used to draw the tooltip content is selected and configured through one of the ToolTipsFactory layout-designers,  the "Override layout designer" or through the Visual Studio property-grid:

The property-grid gives easy access to all properties of the Font-object assigned to the Font-property of the tooltip-component. All font-properties can be directly be changed inside the Visual Studio property-grid (or the corresponding property-grid of the used tooltip layout-designer). The ellipsis-button on the right side of the Font-property indicates that an advanced property-editor is available for the property. The activation of this button opens the standard font-selection dialog, which allows a comfortable visual selection and configuration of the font:

 

The examples below should give an idea about the variety of tooltips that can be created by using different fonts (and other layout-elements):

 

Through code it is not possible at runtime to change the properties of the Font-object assigned to the Font-property of the tooltip component.  Thus, code as the following would not work (and not be accepted by the compiler):

'Assign a new font-size to the font of the tooltip component

Me.MultiLine.GetMultiLineToolTip(Panel1).Font.Size  = 32

This is a shortcoming of the Font-class and it prevents to dynamically adapt the font of a tooltip the easy way. If the Font assigned to a tooltip component has to be changed, it can only be done by creating a new Font-object and assign this new object to the Font-property of the tooltip component:

        

Dim myFont As Font

'Create a new Font with the desired features...

myFont = New Font(FontFamily.GenericSerif, 32, _

                 FontStyle.Italic, GraphicsUnit.Point)

'...and assign it to the Font-property of the tooltip component.

Me.MultiLine1.Font = myFont

If specified at the component-level for a tooltip component (i.e. by defining the Font directly for the component), the assigned value will become the default Font for the tooltips of all controls on the same form:

'Assign a new font to the tooltip component

Me.MultiLine.GetMultiLineToolTip(Panel1).Font = myFont

This default Font can be overridden for each control through the Override-property provided to all controls on the same form by the tooltip component (see "The Override-Property").

If the override-value for the Font has to be set or changed at runtime for the tooltip of a specific control, code like the following is needed:

'Override the default font for the tooltip

'of Panel1...

Me.MultiLine.GetMultiLineToolTip(Panel1). _

Override.Font = underlinedBoldFont