LabelComponent Class

Represents a label for a gauge.

Namespace: DevExpress.XtraGauges.Win.Base

Assembly: DevExpress.XtraGauges.v20.1.Win.dll

Declaration

public class LabelComponent :
    Label,
    ISupportInitialize,
    IBindableComponent,
    IComponent,
    IDisposable,
    ICustomizationFrameClient,
    ISupportCustomizeAction,
    ISupportVisualDesigning,
    ISupportPropertyGridWrapper,
    ISupportAssign<LabelComponent>
Public Class LabelComponent
    Inherits Label
    Implements ISupportInitialize,
               IBindableComponent,
               IComponent,
               IDisposable,
               ICustomizationFrameClient,
               ISupportCustomizeAction,
               ISupportVisualDesigning,
               ISupportPropertyGridWrapper,
               ISupportAssign(Of LabelComponent)

Related API Members

The following members accept/return LabelComponent objects:

Remarks

A label allows custom text to be displayed within any gauge. Use the inherited Label.Text property to specify the text. Labels support HTML formatting, with which you can use HTML tags to format portions of text in a specific manner. See the Label.Text property to learn more.

In code, you can add labels to a gauge via the BaseGaugeWin.Labels collection.

Labels represented by the LabelComponent component do not support the automatic display of a scale's value in circular and linear gauges. To display a scale's value as a label in these gauges, probably along with custom text, you need to add a label to the scale's Labels collection (ArcScale.Labels or LinearScale.Labels). This scale label provides the FormatString property that supports a special placeholder for displaying the scale's current value.

See Scales to learn more.

Examples

The following code shows how to add a static label (LabelComponent) to a circular gauge. The label displays custom text and formats its appearance using HTML tags.

The result is shown below:

Label_Static_ex

using DevExpress.XtraGauges.Win.Base;
using DevExpress.XtraGauges.Core.Drawing;

circularGauge1.BeginUpdate();
LabelComponent label = new LabelComponent("myLabel");
label.AppearanceText.TextBrush = new SolidBrushObject(Color.Black);
label.Position = new DevExpress.XtraGauges.Core.Base.PointF2D(125, 210);
label.ZOrder = -10000;
label.AllowHTMLString = true;
label.Text = "<color=RED>MPH</color> <b>/</b> <color=BLUE>KM/H</color>";
circularGauge1.Labels.Add(label);
circularGauge1.EndUpdate();

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.BaseLabelProvider>
DevExpress.XtraGauges.Core.Model.ScaleIndependentLayerComponent<DevExpress.XtraGauges.Core.Model.BaseLabelProvider>
Label
LabelComponent
See Also