SimpleButton() Constructor

Creates a new SimpleButton object.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

public SimpleButton()
Public Sub New

Remarks

Use this constructor to create a new SimpleButton control at runtime. The constructor initializes the created button with default settings. Note: the new button should be added to a container's Controls collection in order to be displayed.

Examples

The following sample code declares a CreateSimpleButton method that creates and initializes a new SimpleButton control. The method has two parameters specifying the coordinates of the button's top left corner. The BaseButton.CalcBestFit method is used to calculate the size of the button's contents (an image and text) in order to set a proper button size.

The result of the sample code execution is displayed below.

SimpleButton - CalcBestFit

using DevExpress.XtraEditors;
// ...
private void CreateSimpleButton(int left, int top){
   // Creating and initializing a new SimpleButton control
   SimpleButton simpleButton = new SimpleButton();
   Controls.Add(simpleButton);
   simpleButton.Text = "Show Settings Page";
   simpleButton.ImageList = imageList1;
   simpleButton.ImageIndex = 0;
   using(var graphics = simpleButton.CreateGraphics())
       simpleButton.Size = simpleButton.CalcBestFit(graphics);
   simpleButton.Location = new Point(left, top);
}
// Creating SimpleButton control at the specific location
CreateSimpleButton(30, 30);
See Also