Object Model - Common Properties - BorderGradientFrequency

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

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

Property Value

Any integer value > 0. Default value is 1.




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

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


BorderGradient settings Result


The first sample, with BorderGradientFrequency=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 border - it spans over the whole axis (as defined in the BorderGradientMode-property). In our sample tooltip (with BorderGradientMode=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 BorderGradientFrequency=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 BorderGradientFrequency directly for the component), the assigned frequency will become the default BorderGradientFrequency for the tooltips of all controls on the same form:

'Assign a new linear gradient frequency to the tooltip component

Me.MultiLine.GetMultiLineToolTip(Panel1).BorderGradientFrequency = 4

This default BorderGradientFrequency 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 BorderGradientFrequency 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 _

.BorderOverride.BorderGradientFrequency = 20

Example 1

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

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

Me.MultiLine.Border = BorderStyle.LinearGradient

Me.MultiLine.BorderGradientMode = LinearGradientMode.Horizontal

Me.MultiLine.BorderWidth = 15  'make the border 15 pixel wide

'assign the start-color...

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

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

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

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

Me.MultiLine.BorderGradientFrequency = 30