Spread Windows Forms 7.0 Product Documentation
Setting a Multiple Option Cell
See Also Support Options
Spread Windows Forms 7.0 Product Documentation > Developer's Guide > Customizing Interaction with Cell Types > Working with Graphical Cell Types > Setting a Multiple Option Cell

Glossary Item Box

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

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

  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

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

  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

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.