Back to Devexpress

FormControlCollection.AddButton(Cell, Single, Single) Method

officefileapi-devexpress-dot-spreadsheet-dot-formcontrolcollection-dot-addbutton-x28-devexpress-dot-spreadsheet-dot-cell-system-dot-single-system-dot-single-x29.md

latest2.6 KB
Original Source

FormControlCollection.AddButton(Cell, Single, Single) Method

Creates a button form control so that the top left corner of the button is located at the specified cell.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
ButtonFormControl AddButton(
    Cell topLeftCell,
    float width,
    float height
)
vb
Function AddButton(
    topLeftCell As Cell,
    width As Single,
    height As Single
) As ButtonFormControl

Parameters

NameTypeDescription
topLeftCellCell

A cell where the top left corner of the form control is located.

| | width | Single |

The button width.

| | height | Single |

The button height.

|

Returns

TypeDescription
ButtonFormControl

A button form control.

|

Remarks

The code sample below creates a button form control:

csharp
Workbook workbook = new Workbook();
workbook.LoadDocument("Document.xlsx");

var topLeft = workbook.Worksheets[0].Cells["B2"];
var formControls = workbook.Worksheets[0].FormControls;

var buttonFormControl = formControls.AddButton(topLeft, 400,200);
buttonFormControl.PlainText = "Click Here";
buttonFormControl.PrintObject = false;
vb
Dim workbook As New Workbook()
workbook.LoadDocument("Document.xlsx")

Dim formControls = workbook.Worksheets(0).FormControls

Dim topLeft = workbook.Worksheets(0).Cells("B2")
Dim buttonFormControl = formControls.AddButton(topLeft, 400,200)
buttonFormControl.PlainText = "Click Here"
buttonFormControl.PrintObject = False

See Also

FormControlCollection Interface

FormControlCollection Members

DevExpress.Spreadsheet Namespace