StateIndicator Class

Represents the base class for state indicators within gauges of all types.

Namespace: DevExpress.XtraGauges.Core.Model

Assembly: DevExpress.XtraGauges.v19.2.Core.dll

Declaration

public class StateIndicator :
    BaseScaleIndependentComponent<BaseStateIndicatorProvider>,
    IStateIndicator,
    IPrimitive,
    IBaseObject,
    IDisposable,
    ISupportLockUpdate,
    ISupportAssign<StateIndicator>
Public Class StateIndicator
    Inherits BaseScaleIndependentComponent(Of BaseStateIndicatorProvider)
    Implements IStateIndicator,
               IPrimitive,
               IBaseObject,
               IDisposable,
               ISupportLockUpdate,
               ISupportAssign(Of StateIndicator)

Remarks

Each state indicator has a fixed set of states and images corresponding to these states. When a specific state is activated, the indicator displays the corresponding image.

To define states, use the StateIndicator.States property. To select a specific state, use the StateIndicator.StateIndex property.

Examples

The following example shows how to create a state indicator gauge.

In the example a state indicator gauge is created using the GaugeControlBase.AddStateIndicatorGauge method. Then, a state indicator containing four states is added to this gauge. To set the initial state for the state indicator, the StateIndicator.StateIndex property is used.

The result is displayed below:

CreateStateIndicatorGauge_ex

using DevExpress.XtraGauges.Win;
using DevExpress.XtraGauges.Core.Model;
using DevExpress.XtraGauges.Core.Base;
using DevExpress.XtraGauges.Win.Gauges.State;

GaugeControl gc = new GaugeControl();

// Add a state indicator gauge.
StateIndicatorGauge siGauge = gc.AddStateIndicatorGauge();

// Add a state indicator.
StateIndicatorComponent stateIndicator = siGauge.AddIndicator();

// Add states
StateIndicatorShapeType[] shapes = new StateIndicatorShapeType[] {
    StateIndicatorShapeType.TrafficLight1,
    StateIndicatorShapeType.TrafficLight2,
    StateIndicatorShapeType.TrafficLight3,
    StateIndicatorShapeType.TrafficLight4
};

stateIndicator.States.Clear();

foreach(StateIndicatorShapeType shape in shapes) {
    IndicatorState state = new IndicatorState();
    state.ShapeType = shape;
    stateIndicator.States.Add(state);
}

// Set the current state.
stateIndicator.StateIndex = 1;

// Set the indicator's size.
stateIndicator.Size = new SizeF(100, 200);

// Add the gauge control to the form.
gc.Size = new Size(250, 250);
gc.Parent = this;

Inheritance

Object
BaseObject
DevExpress.XtraGauges.Core.Base.BaseElement<DevExpress.XtraGauges.Core.Primitive.IRenderableElement>
DevExpress.XtraGauges.Core.Base.BaseLeaf<DevExpress.XtraGauges.Core.Primitive.IRenderableElement>
BaseLeafPrimitive
DevExpress.XtraGauges.Core.Model.BaseScaleIndependentComponent<DevExpress.XtraGauges.Core.Model.BaseStateIndicatorProvider>
StateIndicator
See Also