Skip to main content

SimpleButton() Constructor

Creates a new SimpleButton object.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public SimpleButton()

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.

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.

SimpleButton - CalcBestFit

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) {
    // ...
}
See Also