You can use a GcComboBox cell to display a drop-down list and allow the user to choose items from the list. The GcComboBox cell also has a resize icon in the lower, right corner of the drop-down.
You can specify colors for each item in the combo cell or you can apply an item template. You can add items to the list with the Add method or add items by setting a data source. The GcComboBox cell also supports automatic completion.
Refer to the GcComboBoxCellType class for a complete list of properties and methods.
This example creates a GcComboBox cell.
C# |
Copy Code
|
---|---|
GrapeCity.Win.Spread.InputMan.CellType.GcComboBoxCellType gccombo = new GrapeCity.Win.Spread.InputMan.CellType.GcComboBoxCellType(); gccombo.Items.Add("Gouda"); gccombo.Items.Add("Swiss"); gccombo.Items.Add("Brie"); gccombo.Items[0].BackColor = Color.Beige; gccombo.Items[1].BackColor = Color.Cornsilk; gccombo.Items[2].BackColor = Color.PeachPuff; fpSpread1.Sheets[0].Cells[0, 0].CellType = gccombo; |
VB |
Copy Code
|
---|---|
Dim gccombo As New GrapeCity.Win.Spread.InputMan.CellType.GcComboBoxCellType() gccombo.Items.Add("Gouda") gccombo.Items.Add("Swiss") gccombo.Items.Add("Brie") gccombo.Items(0).BackColor = Color.Beige gccombo.Items(1).BackColor = Color.Cornsilk gccombo.Items(2).BackColor = Color.PeachPuff fpSpread1.Sheets(0).Cells(0, 0).CellType = gccombo |
Or right-click on the cell or cells and select Cell Type. From the list, select GcComboBox. In the CellType editor, set the properties you need. Click Apply.