Version

Apply the Hatch Brush Element at Run Time

Applying the Hatch brush element to a visual in your gauge gives that element a two-color patterned appearance.

To apply the Hatch 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 instances of the classes:

In Visual Basic:

Dim myHatchBrushElement As New HatchBrushElement()
Dim myRadialGauge As RadialGauge = Me.UltraGauge1.Gauges(0)

In C#:

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

    • back color — DimGray

    • fore color — Silver

    • hatch style — BackwardDiagonal.

In Visual Basic:

myHatchBrushElement.BackColor = System.Drawing.Color.DimGray
myHatchBrushElement.ForeColor = System.Drawing.Color.Silver
myHatchBrushElement.HatchStyle = _
  System.Drawing.Drawing2D.HatchStyle.BackwardDiagonal
myHatchBrushElement.RelativeBounds = _
  New System.Drawing.Rectangle(3, 3, 94, 94)
myHatchBrushElement.RelativeBoundsMeasure = _
  Infragistics.UltraGauge.Resources.Measure.Percent
myRadialGauge.Dial.BrushElement = myHatchBrushElement

In C#:

myHatchBrushElement.BackColor = System.Drawing.Color.DimGray;
myHatchBrushElement.ForeColor = System.Drawing.Color.Silver;
myHatchBrushElement.HatchStyle =
  System.Drawing.Drawing2D.HatchStyle.BackwardDiagonal;
myHatchBrushElement.RelativeBounds =
  new System.Drawing.Rectangle(3, 3, 94, 94);
myHatchBrushElement.RelativeBoundsMeasure =
  Infragistics.UltraGauge.Resources.Measure.Percent;
myRadialGauge.Dial.BrushElement = myHatchBrushElement;