Skip to main content
A newer version of this page is available. .

LinearScale.Labels Property

Provides access to the collection of text labels displayed on the same layer as the current scale.

Namespace: DevExpress.XtraGauges.Core.Model

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

Declaration

[XtraSerializableProperty(XtraSerializationVisibility.Collection, true)]
public virtual LabelCollection Labels { get; }

Property Value

Type Description
LabelCollection

A LabelCollection object that contains text labels.

Remarks

Each item in the collection represents a label, and provides settings to specify a label’s text, positon, size and appearance settings.

Example

The following example shows how to create a scale value label for a linear gauge. The label will indicate the scale’s current value, formatted in a specific manner.

In the example, the label is added via the LinearScale.Labels collection. The result is shown below:

ValueLabel_ex

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

linearScaleComponent1.BeginUpdate();
// Create a label.
ScaleLabel label = new ScaleLabel();
label.Name = "MyLabel";
label.Position = new DevExpress.XtraGauges.Core.Base.PointF2D(160, 125);
label.AppearanceText.TextBrush = new SolidBrushObject("Color:Black");
// Enable HTML formattings and format the label's text via the FormatString property.
label.AllowHTMLString = true;
label.Text = "";
label.FormatString = "T=<b>{1:F0}°</b>";
// Add the label to the scale.
linearScaleComponent1.Labels.Add(label);
linearScaleComponent1.EndUpdate();
See Also