Spread Windows Forms 11.0 Product Documentation
Setting a Multiple Option Cell
Spread Windows Forms 11.0 Product Documentation > Developer's Guide > Customizing Interaction with Cell Types > Working with Graphical Cell Types > Setting a Multiple Option Cell

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.

Orientations of Options Buttons

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 Description
BackgroundImage Sets the background image for the cell.
EditorValue Sets which value is written to the underlying data model.
ItemData Sets the ItemData to use for the list.
Items Creates the list to use for the option buttons.
Orientation Sets the orientation of the option buttons.
Picture Customizes the option button images.
TextAlign Sets how text aligns in the cell.
UseMnemonic Sets whether access keys (hot keys or 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

  1. At design time, in the Properties window, select the Spread component.
  2. Select the Sheets property.
  3. Click the button to display the SheetView Collection Editor.
  4. In the Members list, select the sheet in which the cells appear.
  5. In the property list, select the Cells property and then click the button to display the Cell, Column, and Row Editor.
  6. Select the cells for which you want to set the cell type.
  7. In the property list, select the CellType property and choose the MultiOption cell type.
  8. Expand the list of properties under the CellType property. Select and set these specific properties as needed.
  9. Click OK to close the Cell, Column, and Row Editor.
  10. Click OK to close the SheetView Collection Editor.

Using Code

  1. Define the multiple option list cell by creating an instance of the MultiOptionCellType class.
  2. Specify the items in the list of options.
  3. 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

The following example displays a set of options for the user to choose from.

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;
fpSpread1.ActiveSheet.Columns[0].Width = 220;
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
fpSpread1.ActiveSheet.Columns(0).Width = 220

Using the Spread Designer

  1. Select the cell or cells in the work area.
  2. 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.

  3. From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.
See Also