SpinnerFormControl Interface
Spinner form control.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
public interface SpinnerFormControl :
FormControl,
Shape,
FloatingObject,
ShapeFormatBase,
RangeFormControl,
LinkedCellFormControl,
ShadedFormControl
Related API Members
The following members return SpinnerFormControl objects:
Remarks
Create a Spinner Form Control
The code sample below creates a spinner form control:
Workbook workbook = new Workbook();
workbook.LoadDocument("Document.xlsx");
var formControls = workbook.Worksheets[0].FormControls;
var topLeftCell = workbook.Worksheets[0].Cells["B2"];
var spinner = formControls.AddSpinner(topLeftCell, (float)topLeftCell.ColumnWidth/2, 800);
spinner.SmallChange = 5;
spinner.Min = 1;
spinner.Max = 100;
Note
The FormControlCollection.AddSpinner method call adds a new item to both FormControlCollection and ShapeCollection.
Obtain Spinner Form Controls
The Worksheet.FormControls property obtains all form controls in a worksheet. You can use one of the following ways to obtain a specific form control:
- Access the item in the collection by its index
- Call the FormControlCollection.GetFormControlsByName method
- Call the FormControlCollection.GetFormControlById method
The FormControl.Id and FormControl.Name properties return the form control’s identifier and name.
Modify Scrollbar Form Controls
Use the ScrollbarFormControl
class properties to change scrollbar parameters. The code sample below obtains all spinners and enables 3D shading:
using DevExpress.Spreadsheet;
using System.Linq;
Workbook workbook = new Workbook();
workbook.LoadDocument("Document.xlsx");
var formControls = workbook.Worksheets[0].FormControls;
var scrollbars = formControls.Where(formControl => formControl.FormControlType == FormControlType.Spinner).Cast<SpinnerFormControl>();
foreach (SpinnerFormControl spinners in spinner)
{
spinner.Shading3D = true;
}
Note
ShapeFormatBase.Fill, ShapeFormatBase.Outline and FormControl.ShapeText property returns null
for SpinnerFormControl
.
Remove Spinner Form Controls
Call the FormControlCollection.Remove or FormControlCollection.RemoveAt method to remove a form control. The FormControlCollection.Clear() method removes all form controls from a worksheet.
The code sample below removes all spinners from a worksheet:
Workbook workbook = new Workbook();
workbook.LoadDocument("Document.xlsx");
var formControls = workbook.Worksheets[0].FormControls;
for (int i = formControls.Count - 1; i >= 0; i--) {
if (formControls[i].FormControlType == FormControlType.Spinner)
formControls.RemoveAt(i);
}