Back to Devexpress

BaseGaugeWin.Labels Property

windowsforms-devexpress-dot-xtragauges-dot-win-dot-base-dot-basegaugewin-8b62f87b.md

latest3.1 KB
Original Source

BaseGaugeWin.Labels Property

Provides access to the collection of static labels for the current gauge.

Namespace : DevExpress.XtraGauges.Win.Base

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

NuGet Package : DevExpress.Win.Gauges

Declaration

csharp
[DXCategory("Behavior")]
public LabelComponentCollection Labels { get; }
vb
<DXCategory("Behavior")>
Public ReadOnly Property Labels As LabelComponentCollection

Property Value

TypeDescription
DevExpress.XtraGauges.Win.Base.LabelComponentCollection

A LabelComponentCollection object that represents the collection of static labels for the current gauge.

|

Remarks

Use this collection to add, remove or modify static labels for a gauge. See Labels and Images to learn more.

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()

See Also

AddLabel()

Labels and Images

BaseGaugeWin Class

BaseGaugeWin Members

DevExpress.XtraGauges.Win.Base Namespace