Spread Windows Forms 8.0 Product Documentation > Developer's Guide > Customizing Interaction with Cell Types > Working with Graphical Cell Types > Setting a List Box Cell |
You can use a list box cell to display a list -- allowing the user to select from the displayed list. You can specify the list of items, whether to include icons to appear along with text, the number that is displayed at any time, and other aspects of the display.
Text only |
Text and icon |
---|---|
To create a cell that acts like a list box, use the ListBoxCellType class. Create a list box cell using the procedures described below.
Here is a summary of the appearance properties that you can use to customize the list box.
Property |
Description |
---|---|
Set what value is written to the underlying data model. |
|
Set an image list for displaying icons along with text in the list. |
|
Set the height for each item in the list. |
|
Set item data, which is different from the items that are displayed, to use for the list. |
|
Set items to use for the list. |
For a complete list of the properties and methods of this cell type, refer to the ListBoxCellType class. For information on the combo box (which includes both a list box and an editable area), refer to Setting a Combo Box Cell.
C# |
Copy Code
|
---|---|
FarPoint.Win.Spread.CellType.ListBoxCellType listcell = new FarPoint.Win.Spread.CellType.ListBoxCellType(); listcell.ImageList = ImageList1; listcell.ItemData = new string[] { "One", "Two", "Three"}; listcell.Items = new string[] {"One","Two","Three"}; listcell.ItemHeight = 40; fpSpread1.ActiveSheet.Cells[0, 0].CellType = listcell; |
VB |
Copy Code
|
---|---|
Dim listcell As New FarPoint.Win.Spread.CellType.ListBoxCellType() listcell.ImageList = ImageList1 listcell.ItemData = New String() {"One", "Two", "Three"} listcell.Items = New String() {"One", "Two", "Three"} listcell.ItemHeight = 40 FpSpread1.ActiveSheet.Cells(0, 0).CellType = listcell |
Or right-click on the cell or cells and select Cell Type. From the list, select ListBox. In the CellType editor, set the properties you need. Click Apply.