ToolTipsFactory

Object Model - Additional Properties - BackColor

Gets or sets a value which defines the color for solid tooltip content-backgrounds.

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

Property Value

Any color provided by the System.Drawing.Color class.

Overridable

Layout-file

Property of
AnimationTT ImageTT SingleLineTT MultiLineTT

Description

This property defines the color to be used for either solid tooltip content-backgrounds (Background=Normal) or as background-color for the hatch pattern of tooltips with hatched backgrounds (Background=Hatch).

This property is only significant for tooltip-layouts where the BackgroundStyle assigned to Background is either Normal or Hatch. For the AnimationToolTip-component it has only a visible effect if the movie-clip (Animation) has transparent or semi-transparent areas. In this case the color assigned to BackColor will shine through. The following table shows some samples:

 

Background settings Result

 

The second example shows, that transparent backgrounds are supported. This gives the possibility to create some interesting effects. Also hatched backgrounds with transparency (BackColor=Color.Transparent; Background=Hatch) are supported:

 

 

The inverse (BackColor <> Color.Transparent and BackgroundHatchColor = Color.Transparent) is not possible.

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 BackColor for the tooltips of all controls on the same form. This default BackColor 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 BackColor has to be set or changed at runtime for the tooltip of a specific control, code like the following is needed:

Me.MultiLine.GetMultiLineToolTip(Panel1) _

.Override.BackgroundOverride.BackColor = Color.Red

Example 1

This statements define a default solid green background for all controls on the same form as the tooltip component:

'define a solid green background...

Me.MultiLine.Background = BackgroundStyle.Normal

Me.MultiLine.BackColor = Color.Green 'assign the desired color

Example 2

This changes the BackColor for the tooltip of Panel1 to a random color and enforces the overridden background to be painted with this solid color.

'First, we get random values for the red, green and red

'components of the color to assign.

Dim R,G,B As Integer

R = CInt(Int((256) * Rnd()))
G = CInt(Int((256) * Rnd()))
B = CInt(Int((256) * Rnd()))

'Then we create the color with the random RGB-components and assign

'the resulting color as BackgroundOverride.BackColor.

Me.MultiLine.GetMultiLineToolTip(Panel1).Override _

.BackgroundOverride.BackColor = Color.FromArgb(R,G,B)

'And to make sure this really applies, we also set

'the other properties correctly to get a solid background....

Me.MultiLine.GetMultiLineToolTip(Panel1).Override _ 

.BackgroundOverride.Background = BackgroundStyle.Normal