ToolTipsFactory

Object Model - Additional Properties - BackgroundGradientShape

Gets or sets a value that specifies the shape to be used to create the transition from the start color of the gradient to the end color.

[Visual Basic]
Public Property BackgroundGradientShape As GradientShape
[C#]
public GradientShape BackgroundGradientShape {get; set;}

Property Value

Any value of the GradientShape-enumeration. Default value is GradientShape.Linear

Overridable

Layout-file

Property of
AnimationTT ImageTT SingleLineTT MultiLineTT

Description

This value defines the shape to be used to render the transition from the start to the end color of the linear gradient used to paint the tooltip background. It is only significant for layouts where Background=LinearGradient.

The selected shape defines how fast the starting color is blended into the ending color along the path of the gradient. The gradient can be imagined as a hill, where the GradientShape represents the slope which falls off symmetrically on both sides of the peak. The ending color is located at the peak of the hill, while the start color resides at the lowest end of the slope. Now, the height of a given point on the slope defines the relative density of ending- and starting-color in the blended color. In other words, at the peak of the curve, we get 100% ending-color, while at the lower end of the slope the color will be pure starting-color. In the case of a linear curve (i.e. a straight line - BackgroundGradientShape=Linear) the gradient transitions equally distributed from one color to the other - the point with 50% starting- and 50% ending-color would be exactly in the middle of the gradient. This would be different for a bell curved shape (as in a normal distribution - BackgroundGradientShape=SigmaBell): Here the ending-color starts to blend only slowly into the the starting-color (the top of the bell). The steeper middle part of the bell curve makes then blend the colors more rapidly as in the linear case. The lower part of the bell curve is again almost plane, what makes the color-blending slower again.

The concept of gradient shapes is easier to understand with some rendered examples, as provided by the following table. In the samples we use BackgroundGradientMode=Horizontal, which makes the gradient flow from left to right. In order to make the samples match with what was said above, we also set the BackgroundGradientFocus=0.5 (this moves the peak of the selected shape to the middle of the rendered gradient - please see the reference section on BackgroundGradientFocus for more details).

 

BackgroundGradient settings Result

The linear gradient shape ignores the value set for BackgroundGradientFocus. Therefore it is not possible to move it's focus.

This shows the color-representation of a bell curve: The middle part of the gradient shows only little color blending - the ending color (White) prevails. The middle part on both sides of the center blends the colors quiet quickly, while the blending slows down towards the left and right edges and the start color (Indigo) prevails.
The triangular shape is nothing more then a linear rendering on both sides of the peak. With the focus set in the center of the gradient (0.5) it gives the same result as a gradient with BackgroundGradientShape=Linear and BorderGradientFrequency=2. The only difference is, that the Triangular shape allows to freely move around the focus (the peak of the shape) along the axis of the gradient, while this is not possible if the BackgroundGradientShape is set to Linear.

 

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

'Assign a new linear gradient shape to the tooltip component

Me.MultiLine.GetMultiLineToolTip(Panel1).BackgroundGradientShape = GradientShape.SigmaBell

This default BackgroundGradientShape 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 BackgroundGradientShape 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 shape to the override-object for Panel1

Me.MultiLine.GetMultiLineToolTip(Panel1).Override _

.BackgroundOverride.BackgroundGradientShape = GradientShape.Triangular

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 BackgroundGradientShape 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 the gradient shape = Triangular...

Me.MultiLine.BackgroundGradientShape = GradientShape.Triangular

'...and the move it's focus to a position left of the center.

Me.MultiLine.BackgroundGradientFocus = 0.34