Skip to main content
All docs
V24.1
Row

ScrollbarFormControl Interface

Scrollbar form control.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public interface ScrollbarFormControl :
    FormControl,
    Shape,
    FloatingObject,
    ShapeFormatBase,
    RangeFormControl,
    LinkedCellFormControl,
    ShadedFormControl

Remarks

Create a Scrollbar Form Control

The code sample below creates a scrollbar form control:

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

var formControls = workbook.Worksheets[0].FormControls;

var cellRange = workbook.Worksheets[0].Range["B2:B8"];
var scrollbarFormControl = formControls.AddScrollbar(cellRange);
scrollbarFormControl.Min = 2;
scrollbarFormControl.Max = 15;
scrollbarFormControl.LargeChange = 10;
scrollbarFormControl.SmallChange = 1;

Note

The FormControlCollection.AddScrollbar method call adds a new item to both FormControlCollection and ShapeCollection.

Obtain Scrollbar 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:

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 scrollbars 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.Scrollbar).Cast<ScrollbarFormControl>();
foreach (ScrollbarFormControl scrollbar in scrollbars)
{
    scrollbar.Shading3D = true;
}

Note

ShapeFormatBase.Fill, ShapeFormatBase.Outline, and FormControl.ShapeText property returns null for ScrollbarFormControl.

Remove Scrollbar 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 scrollbars 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.Scrollbar)
        formControls.RemoveAt(i);
}
See Also