ToolTipsFactory

Object Model - Additional Properties - AutoSize

Gets or sets a value which controls whether the tooltip should enforce the defined DefaultWidth or if it should adapt it's size dynamically to the content to be displayed.

[Visual Basic]
Public Property AutoSize As Boolean
[C#]
public bool AutoSize {get; set;}

Property Value

A boolean value. The default-value is True.

Overridable

Layout-file

Property of
AnimationTT ImageTT SingleLineTT MultiLineTT

Description

This property determines whether the tooltip should enforce the defined DefaultWidth or if it should adapt it's size dynamically to the content to be displayed. Because the effect of this property (which is tightly coupled to the DefaultWidth-property) on the tooltip-layout differs substantially from component to component, the different semantics of the AutoSize-property is described for each tooltip component individually:

 

Component Description
ToolTipsFactorySingleLine The SingleLineTooltips show their content (obviously) as one single line of text. The theoretical width of the rendered text in the tooltip depends on the text to be displayed and the font-settings. The DefaultWidth determines the maximum width of the rendered text. This means, only as much of the text is rendered as fits in the width defined by DefaultWidth. If the text exceeds this limits, it will be truncated and the truncation is made visible by an ellipsis (...), as shown in Picture 1

Now, the DefaultWidth is only applied if the AutoSize-property is set to False. If AutoSize=True, the full text will be rendered as long as it does not exceed the limits given by the screen-resolution (see Picture 2).


(Picture 1)

(Picture 2)
ToolTipsFactoryMultiLine This component handles slightly different then the SingleLineToolTip-component. Again, the DefaultWidth is applied only if  AutoSize=False. In this case, the tooltip text will be forced in to this horizontal limits, but the text is wrapped into as many lines as needed - i.e. the vertical tooltip size is dynamically adapted (see Picture 3). It should be noted, that the wrapping happens at the character-level, which seldom leads to acceptable results.

With AutoSize=True, the text is also wrapped and the tooltip-height dynamically corrected. The difference to the SingleLineToolTip is that this time word-wrapping is used. The tooltip takes into account the defined DefaultWidth and tries to wrap the text within this boundaries. But if there is a single word that exceeds the DefaultWidth, the tooltip-width is dynamically expanded to fit the longest word in one line (see Picture 4).


(Picture 3)

(Picture 4)

 

Setting DefaultWidth=0 turns the component off and no tooltips will displayed for controls which have content specified for the specific tooltip (for tooltips with AutoSize-property, AutoSize must be set to False, to turn off the tooltip-display this way).

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

'Turn auto-sizing of for this tooltip component

Me.MultiLine.AutoSize = False

This default AutoSize-value 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 AutoSize has to be set or changed at runtime for the tooltip of a specific control, code like the following is needed:

'Override the default auto-sizing for the tooltip

'of Panel1...

Me.MultiLine.GetMultiLineToolTip(Panel1).Override.AutoSize = False