Object Model - Additional Properties - Alignment

Gets or sets a value which defines the alignment of text in the tooltip.

[Visual Basic]
Public Property Alignment As System.Drawing.StringAlignment
public System.Drawing.StringAlignment Alignment {get; set;}

Property Value

A value from the StringAlignment enumeration. Default value is StringAlignment.Near.



Property of
AnimationTT ImageTT SingleLineTT MultiLineTT


This property defines how the text displayed in the tooltip should be aligned. The StringAlignment-enumeration offers three values from which to choose: Near (=Left), Center and Far (=Right).

This property is also provided by the SingleLineToolTip component, but actually it has no visible influence, because the width of the tooltip is always adapted (shrunk) to the size of the text, as long as the resulting size is smaller as the specified DefaultWidth.

In contrast to the SingleLineToolTip, the effect of this property is definitely visible in the MultiLineToolTips, as shown below:


Near Center Far



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

'Define a new alignment for the tooltip component...

Me.MultiLine.Alignment = StringAlignment.Center

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

'Override the default text-alignment for the tooltip

'of Panel1...

Me.MultiLine.GetMultiLineToolTip(Panel1).Override _

.Alignment = StringAlignment.Far