Object Model - Additional Properties - Background

Gets or sets a value which defines the BackgroundStyle for the tooltip.

[Visual Basic]
Public Property Background As ToolTipsFactory.Enums.BackgroundStyle
public ToolTipsFactory.Enums.BackgroundStyle Background {get; set;}

Property Value

A value from the ToolTipsFactory.Enums.BackgroundStyle enumeration. 



Property of
AnimationTT ImageTT SingleLineTT MultiLineTT


This property defines which kind of background to use for the tooltip. The following BackgroundStyles are available: 


Style Description Example Rendering properties
Normal The tooltip will be painted with a solid color background. The color used for this background-style is the value assigned to the property BackColor.


LinearGradient The tooltip background will be painted with a linear color gradient. The range of colors to be used for the gradient are specified in the BackgroundGradientColors-property.







(There are 13 texture-related background-styles. See BackTexture for more details)

The tooltip background will be painted with the texture assigned to the BackTexture-property.


Hatch A hatched background will be painted using the hatch-pattern assigned to the BackgroundHatchStyle-property. The foreground color used to draw the hatch-pattern is the color assigned to the BackgroundHatchColor-property, while the background color is taken from the BackColor-property.




Table 1


The Background-property only defines what kind of background should be applied to the tooltip. The details on how the selected BackgroundStyle has to be rendered, are specified by various other properties of the tooltip component. Table 1 shows this rendering properties for each BackgroundStyle. Only the values assigned to this properties will affect the corresponding BackgroundStyle.

If specified at the component-level for a tooltip component (i.e. by assigning the value directly to the component), the assigned value will become the default BackgroundStyle for the tooltips of all controls on the same form. This default Background 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").

Please note: If Background is to be overridden in code (as shown in Example 2),  a different enumeration then BackgroundStyle has to be used. The BackgroundStyleOverride-enumeration is equivalent to the BackgroundStyle-enum, but it provides one more value (OverrideOff), which is used to reset the background-override.

Example 1

This statement defines a default Background for all controls on the same form as the tooltip component:

'set the default background-style to LinearGradient...

Me.MultiLine.Background = BackgroundStyle.LinearGradient

Me.MultiLine.BackgroundGradientColors(0) = Color.Red    'gradient start-color

Me.MultiLine.BackgroundGradientColors(1) = Color.Yellow 'gradient end-color

Example 2

How to override the default Background-style (or any other overridable property) through the various designers and editors in Visual Studio is extensively discussed in "The Override-Property". If the override-value for the Background-style has to be set or changed at runtime for the tooltip of a specific control, the following code is needed:

'This changes the background-style for the tooltip of Panel1

'to "Texture"...

Me.MultiLine.GetMultiLineToolTip(Panel1).Override _

.BackgroundOverride.Background = BackgroundStyleOverride.TextureStretch

'...and loads the desired texture from an image-file.

Me.MultiLine.GetMultiLineToolTip(Panel1).Override _

.BackgroundOverride.BackgroundTexture = Image.FromFile("C:\Temp\water.jpg")