ToolTipsFactory

Object Model - Common Methods and Functions - ApplyFontOverrides

This method applies a font-layout stored in a TTFontLayoutOverride-object to the tooltip-component.

[Visual Basic]
Public Sub ApplyFontOverrides( _
	ByVal fontOverride As TTFontLayoutOverride
)
[C#]
public void ApplyFontOverrides(
	TTFontLayoutOverride fontOverride 
);

Parameters

fontOverride

A TTFontLayoutOverride-object which contains a tooltip font-layout.

Description

This method applies a font-layout stored in a TTFontLayoutOverride-object to the tooltip-component in order to override the default values defined for the component. Usually this method is used internally by the ApplyOverrides()-method of the different components. Only ApplyOverrides() makes sure that the component saves the complete current layout before the override-values are applied. The saved layout can later be restored with a call to RestoreOriginalLayout(). This ApplyOverrides()-RestoreOriginalLayout()-cycle happens automatically for the override-values defined through the Override-property of a control (see Provided Properties).

ApplyFontOverrides() does not make such a copy of the layout-values it is going to change! If ApplyFontOverrides() is going to be used directly to apply a new font-layout, the application developer is responsible to make sure that the original (or default) values can be restored.

Actually, the only scenario, where the direct use of ApplyFontOverrides() could be useful, is if the override-values specified for a control should also dynamically be overridden. (E.G. the tooltip-font for a specific control should look different every time the tooltip does pop-up.) 

Example

The following code creates a TTFontLayoutOverride-object, sets the values for the layout-properties to be overridden and applies it to the component.

'Declare and create an instance of TTFontLayoutOverride...

Dim myFontLayout As ToolTipsFactory.Shared.TTFontLayoutOverride

myFontLayout = New ToolTipsFactory.Shared.TTFontLayoutOverride

'Declare a color-array for the font gradient-colors...

Dim fontCols(2) As Color

fontCols(0) = Color.Indigo

fontCols(1) = Color.Red

'Assign values to the properties to be overridden..

myFontLayout.TextStyle = TextDrawingStyleOverride.LinearGradient

myFontLayout.FontGradientColors = fontCols

'Apply the new font-layout to the component...

Me.MultiLine.ApplyFontOverrides(myFontLayout)

After the execution of this code, the next time a tooltip, provided to a control by MultiLine, will be displayed, it will appear with the applied font. If the original font-layout has not been saved somehow, the applied font-layout will become the default font-layout for the tooltips of all controls on the same form.