SimpleButton.Text Property
Gets or sets the text string displayed within the button control.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Property Value
Type | Description |
---|---|
String | A string value representing the button’s caption. |
Remarks
Changing this property’s value at runtime raises the TextChanged event.
The button’s text is not displayed if the SimpleButton.ImageLocation property is set to MiddleCenter and an image is assigned to the button via the SimpleButton.ImageIndex or SimpleButton.Image properties. In this instance, only the image centered within the button is displayed.
If the SimpleButton.AllowHtmlDraw property is set to true, you can use HTML tags to format the SimpleButton.Text. For detailed information see HTML Text Formatting.
Example
The following code creates a SimpleButton at a specific location and subscribes to the button’s Click
event. The BaseButton.CalcBestFit method is used to calculate the button size that fits the button’s contents.
using DevExpress.XtraEditors;
// ...
CreateSimpleButton(30, 30);
// ...
private void CreateSimpleButton(int left, int top) {
SimpleButton simpleButton = new SimpleButton();
Controls.Add(simpleButton);
simpleButton.Text = "Show Settings Page";
simpleButton.ImageOptions.ImageList = imageCollection1;
simpleButton.ImageOptions.ImageIndex = 0;
simpleButton.Padding = new Padding(10);
using(var graphics = simpleButton.CreateGraphics())
simpleButton.Size = simpleButton.CalcBestFit(graphics);
simpleButton.Location = new Point(left, top);
simpleButton.Click += SimpleButton_Click;
}
private void SimpleButton_Click(object sender, EventArgs e) {
// ...
}
Related GitHub Examples
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.