You can define multiple option buttons in a multiple option cell. This cell type offers several option buttons, either horizontally or vertically, for the user to select. Only one button can be selected at a time. The default is for none of the buttons to be selected.
To create a cell that acts like a list of multiple option buttons, use the MultiOptionCellType class. Create a multiple option cell using the following procedure.
Customizing Display and Operation
You can customize the display and operation of the multiple options in the cell by setting the following properties.
Property |
Customization |
---|---|
BackgroundImage |
Set the background image for the cell. |
EditorValue |
Set which value is written to the underlying data model. |
ItemData |
Set the ItemData to use for the list. |
Items |
Create the list to use for the option buttons. |
Orientation |
Set the orientation of the option buttons. |
Picture |
Customize the option button images. |
TextAlign |
Set how text aligns in the cell. |
UseMnemonic |
Set whether hot keys (keyboard shortcuts) are used in the cell. |
For more information on the properties and methods of this cell type, refer to the MultiOptionCellType class.
For more information on the corresponding event when a user clicks on an option, refer to the FpSpread.ButtonClicked event.
Using the Properties Window
- At design time, in the Properties window, select the Spread component.
- Select the Sheets property.
- Click the button to display the SheetView Collection Editor.
- In the Members list, select the sheet in which the cells appear.
- In the property list, select the Cells property and then click the button to display the Cell, Column, and Row Editor.
- Select the cells for which you want to set the cell type.
- In the property list, select the CellType property and choose the MultiOption cell type.
- Expand the list of properties under the CellType property. Select and set these specific properties as needed.
- Click OK to close the Cell, Column, and Row Editor.
- Click OK to close the SheetView Collection Editor.
Using Code
- Define the multiple option list cell by creating an instance of the MultiOptionCellType class.
- Specify the items in the list of options.
- Assign the multiple option cell type to a cell or range of cells by setting the CellType property for a cell, column, row, or style to the MultiOptionCellType object.
Example
Display the list of several elements.
C# | Copy Code |
---|---|
FarPoint.Win.Spread.CellType.MultiOptionCellType multcell = new FarPoint.Win.Spread.CellType.MultiOptionCellType(); multcell.Items = new String[] {"Carbon", "Oxygen", "Hydrogen"}; multcell.Orientation = FarPoint.Win.RadioOrientation.Horizontal; fpSpread1.ActiveSheet.Cells[0, 0].CellType = multcell; |
VB | Copy Code |
---|---|
Dim multcell As New FarPoint.Win.Spread.CellType.MultiOptionCellType() multcell.Items = new String() {"Carbon", "Oxygen", "Hydrogen"} multcell.Orientation = FarPoint.Win.RadioOrientation.Horizontal FpSpread1.ActiveSheet.Cells(0, 0).CellType = multcell |
Using the Spread Designer
- Select the cell or cells in the work area.
- In the property list, in the Misc category, select CellType. From the drop-down list, choose the MultiOption cell type. Now expand the CellType property and various properties are available that are specific to this cell type. Select and set those properties as needed.
Or right-click on the cell or cells and select Cell Type. From the list, select MultiOption. In the CellType editor, set the properties you need. Click Apply.
- From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.