Version

Apply the Simple Gradient Brush Element at Run Time

If you want a property of your gauge to start with one color and fade into another color in a specific way, apply the Simple Gradient brush element to the property.

To apply a Simple Gradient brush element to a property of your gauge using code:

  1. Before you start writing any code, you should place using/Imports directives in your code-behind so you don’t need to always type out a member’s fully qualified name.

In Visual Basic:

Imports Infragistics.UltraGauge.Resources

In C#:

using Infragistics.UltraGauge.Resources;
  1. Create the load event.

  2. Create an instance of the Simple Gradient brush element.

In Visual Basic:

Dim myRadialGauge As RadialGauge = Me.UltraGauge1.Gauges(0)
Dim simpleGradientBrushElement1 As New SimpleGradientBrushElement()

In C#:

RadialGauge myRadialGauge = this.ultraGauge1.Gauges[0] as RadialGauge;
SimpleGradientBrushElement simpleGradientBrushElement1 =
  new SimpleGradientBrushElement();
  1. Set the following properties:

    • start color — 192, 0, 0

    • end color — Black

    • gradient style — BackwardDiagonal

In Visual Basic:

simpleGradientBrushElement1.EndColor = System.Drawing.Color.Black
simpleGradientBrushElement1.RelativeBounds = _
  New System.Drawing.Rectangle(3, 3, 94, 94)
simpleGradientBrushElement1.RelativeBoundsMeasure = _
  Infragistics.UltraGauge.Resources.Measure.Percent
simpleGradientBrushElement1.StartColor = _
  System.Drawing.Color.FromArgb(CInt(CByte(192)), _
  CInt(CByte(0)), CInt(CByte(0)))
myRadialGauge.Dial.BrushElement = simpleGradientBrushElement1

In C#:

simpleGradientBrushElement1.EndColor = System.Drawing.Color.Black;
simpleGradientBrushElement1.RelativeBounds =
  new System.Drawing.Rectangle(3, 3, 94, 94);
simpleGradientBrushElement1.RelativeBoundsMeasure =
  Infragistics.UltraGauge.Resources.Measure.Percent;
simpleGradientBrushElement1.StartColor =
  System.Drawing.Color.FromArgb(((int)(((byte)(192)))),
  ((int)(((byte)(0)))), ((int)(((byte)(0)))));
myRadialGauge.Dial.BrushElement = simpleGradientBrushElement1;