Back to Devexpress

Label Class

corelibraries-devexpress-dot-xtragauges-dot-core-dot-model-7432e7c8.md

latest3.7 KB
Original Source

Label Class

Represents the base class for labels in gauges.

Namespace : DevExpress.XtraGauges.Core.Model

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

NuGet Package : DevExpress.Gauges.Core

Declaration

csharp
public class Label :
    ScaleIndependentLayerComponent<BaseLabelProvider>,
    ILabelEx,
    ILabel,
    IBaseObject,
    IDisposable,
    ISupportLockUpdate,
    ISupportAcceptOrder,
    ISupportAssign<ILabel>,
    INamed,
    ISupportAssign<Label>
vb
Public Class Label
    Inherits ScaleIndependentLayerComponent(Of BaseLabelProvider)
    Implements ILabelEx,
               ILabel,
               IBaseObject,
               IDisposable,
               ISupportLockUpdate,
               ISupportAcceptOrder,
               ISupportAssign(Of ILabel),
               INamed,
               ISupportAssign(Of Label)

Remarks

In Windows Forms, labels are represented by LabelComponent class objects.

Example

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:

csharp
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();
vb
Imports DevExpress.XtraGauges.Win.Base
Imports DevExpress.XtraGauges.Core.Drawing

circularGauge1.BeginUpdate()
Dim label As LabelComponent = 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()

Implements

IXtraSerializable

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

Label Members

DevExpress.XtraGauges.Core.Model Namespace