Object Model - Additional Properties - BackgroundGradientFrequency

Gets or sets a value that specifies how many times a linear gradient should be repeated to paint the tooltip background.

[Visual Basic]
Public Property BackgroundGradientFrequency As Integer
public int BackgroundGradientFrequency {get; set;}

Property Value

Any positive integer value > 0. Default value is 1.



Property of
AnimationTT ImageTT SingleLineTT MultiLineTT


This value defines how many times (frequency) a linear gradient will be repeated along the selected axis defined in the BackgroundGradientMode-property. This value is only significant for layouts where Background is set to LinearGradient.

The impact of the BackgroundGradientFrequency on the visual appearance of the tooltip border is best shown with a sample gradient background rendered with different values for BackgroundGradientFrequency:


BackgroundGradient settings Result


The first sample, with BackgroundGradientFrequency=1, represents a complete linear gradient from start color to end color. With the frequency of 1 (which is the default) this gradient completely fills the tooltip background - it spans over the whole axis (as defined in the BackgroundGradientMode-property). In our sample tooltip (with BackgroundGradientMode=Horizontal), the axis for the linear gradient spans form left to right, while in the vertical and the diagonal modes it would span from top to bottom respectively from the upper left to the lower right corner.

In the second sample, with BackgroundGradientFrequency=2, the linear gradient was painted twice. I.e., a complete gradient from start to end color is now compressed into half of the length of the gradient axis. Because the length of the axis is determined by the dimensions of the tooltip, it is clear that with increasing frequency the length of the gradient from start to end color must become proportionally shorter. And this is exactly what we see reflected by the samples. 

The samples also show that the complete gradient form start to end color is continously flipped along the axis to prevent abrupt color changes. This ensures smooth transitions from one gradient to the next.

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

'Assign a new linear gradient frequency to the tooltip component

Me.MultiLine.GetMultiLineToolTip(Panel1) _

.BackgroundGradientFrequency = 4

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

'Assign a new linear gradient frequency to the override-object for Panel1

Me.MultiLine.GetMultiLineToolTip(Panel1).Override _

.BackgroundOverride.BackgroundGradientFrequency = 20

Example 1

This statements define a linear gradient background at the component level. The individual colors of the BackgroundGradientColors-property are changed and a new BackgroundGradientFrequency is defined:

'define a linear gradient background for the tooltips provided by the component (MultiLine).

Me.MultiLine.Background = BackgroundStyle.LinearGradient

Me.MultiLine.BackgroundGradientMode = LinearGradientMode.Horizontal

'assign the start-color...

Me.MultiLine.BackgroundGradientColors(0) = Color.OrangeRed 

'...and the end-color for the gradient.

Me.MultiLine.BackgroundGradientColors(1) = Color.Blue

'Set a high gradient frequency to get a nicely striped border

Me.MultiLine.BackgroundGradientFrequency = 30