windowsforms-devexpress-dot-xtraeditors-dot-labelcontrol-33aabbb3.md
Gets or sets the label’s text.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DefaultValue("")]
[DXCategory("Appearance")]
[SettingsBindable(true)]
public override string Text { get; set; }
<DXCategory("Appearance")>
<SettingsBindable(True)>
<DefaultValue("")>
Public Overrides Property Text As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A String value that specifies the label’s text.
|
If the LabelControl.AllowHtmlString property is set to true , you can use HTML tags to format the Text. For detailed information, see HTML Text Formatting.
Note
Long words are not wrapped if the Text option is enabled.
The following example shows how to format a LabelControl‘s text using HTML tags. HTML formatting is enabled with the LabelControl.AllowHtmlString property. To respond to end-user clicks on a hyperlink, the LabelControl.HyperlinkClick event is handled. The image below shows the result:
labelControl1.Text = "<size=14>Size = 14
" +
"<b>Bold</b> <i>Italic</i> <u>Underline</u>
" +
"<size=11>Size = 11
" +
"<color=255, 0, 0>Sample Text</color></size>" +
"<href=www.devexpress.com>Hyperlink</href>";
labelControl1.AllowHtmlString = true;
labelControl1.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
labelControl1.Appearance.Options.UseTextOptions = true;
labelControl1.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Vertical;
labelControl1.HyperlinkClick += LabelControl1_HyperlinkClick;
private void labelControl1_HyperlinkClick(object sender, DevExpress.Utils.HyperlinkClickEventArgs e) {
System.Diagnostics.Process.Start(e.Link);
}
labelControl1.Text = "<size=14>Size = 14
" + _
"<b>Bold</b> <i>Italic</i> <u>Underline</u>
" + _
"<size=11>Size = 11
" + _
"<color=255, 0, 0>Sample Text</color></size>
" + _
"<href=www.devexpress.com>Hyperlink</href>"
labelControl1.AllowHtmlString = True
labelControl1.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap
labelControl1.Appearance.Options.UseTextOptions = True
labelControl1.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Vertical
labelControl1.HyperlinkClick += LabelControl1_HyperlinkClick
Private Sub LabelControl1_HyperlinkClick(sender As Object, e As DevExpress.Utils.HyperlinkClickEventArgs) Handles LabelControl1.HyperlinkClick
System.Diagnostics.Process.Start(e.Link)
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the Text property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
LabelControl label = new LabelControl();
label.Text = "Click to Execute Command";
label.Dock = DockStyle.Fill;
dashboardDesigner1.AsyncMode = true;
lblMode.Text = "ASYNC";
dashboardDesigner1.LoadDashboard("test.xml");
xaf-how-to-create-information-panels/CS/EFCore/InfoPanelEF/InfoPanelEF.Win/XafSplashScreen.cs#L38
LoadBlankLogo();
this.labelCopyright.Text = "Copyright © " + DateTime.Now.Year.ToString() + " Company Name" + System.Environment.NewLine + "All rights reserved.";
UpdateLabelsPosition();
LoadBlankLogo();
this.labelCopyright.Text = "Copyright © " + DateTime.Now.Year.ToString() + " Company Name" + System.Environment.NewLine + "All rights reserved.";
UpdateLabelsPosition();
LoadBlankLogo();
this.labelCopyright.Text = "Copyright © " + DateTime.Now.Year.ToString() + " Company Name" + System.Environment.NewLine + "All rights reserved.";
UpdateLabelsPosition();
Dim label As New LabelControl()
label.Text = "Click to Execute Command"
label.Dock = DockStyle.Fill
dashboardDesigner1.AsyncMode = True
lblMode.Text = "ASYNC"
dashboardDesigner1.LoadDashboard("test.xml")
XPO_how-to-filter-a-collection-by-an-associated-objects-properties-e886/VB/Form1.vb#L295
If ReferenceEquals(criteria, Nothing) Then
labelControl1.Text = String.Empty
Else
winforms-scheduler-customize-appointment-flyout/VB/CustomAppointmentFlyoutExample/MyFlyout.vb#L16
InitializeComponent()
labelControl1.Text = subject
labelControl2.Text = start.ToString()
winforms-save-restore-active-skin-palette/VB/DXApplication1/Form1.vb#L56
Private Sub ShowSettings()
labelControl1.Text = Settings.Default.SkinName
labelControl4.Text = If(Not Equals(Settings.Default.Palette, String.Empty), Settings.Default.Palette, "n/a (default palette or raster skin)")
See Also