Spread Windows Forms 8.0 Product Documentation
Allowing a Combo Box Cell to Handle a Double Click

By default, a combo box cell (ComboBoxCellType) cannot receive a double click with the left mouse button. The cell goes into edit mode on the first click, so the next click goes to the FpCombo control that is the subeditor. To handle double-clicking on a combo box cell, use code based on the example shown here.

For more information on the properties and methods of this cell type, refer to the ComboBoxCellType class.

For information on the graphical cell types, refer to Working with Graphical Cell Types.

For information on other features of cell types, refer to Understanding Additional Features of Cell Types.

Using Code

  1. Define a combo box cell by creating an instance of the ComboBoxCellType class.
  2. Define the items in the combo box list.
  3. Handle the double-click event.

Example

C#
Copy Code
private void Form1_Load(object sender, System.EventArgs e)
{
    FarPoint.Win.Spread.CellType.ComboBoxCellType c = new     FarPoint.Win.Spread.CellType.ComboBoxCellType();
    c.Items = new String[] {"a", "b", "c"};
    fpSpread1.Sheets[0].Rows[0].CellType = c;

}
   
private void HeaderDoubleClick(object sender, System.EventArgs e)
{
}
   
private void FpSpread1_EditModeOn(object sender, System.EventArgs e)
{
    FarPoint.Win.FpCombo c;
    if (fpSpread1.Sheets[0].ActiveRowIndex == 0)
    {
        c = ((FarPoint.Win.FpCombo)(fpSpread1.EditingControl));
        c.Click += new System.EventHandler(HeaderDoubleClick);
    } }
VB
Copy Code
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Dim c As New FarPoint.Win.Spread.CellType.ComboBoxCellType
     c.Items = New String() {"a", "b", "c"}
     FpSpread1.Sheets(0).Rows(0).CellType = c
End Sub
   
Private Sub HeaderDoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
Private Sub FpSpread1_EditModeOn(ByVal sender As Object, ByVal e As System.EventArgs) Handles FpSpread1.EditModeOn
     Dim c As FarPoint.Win.FpCombo
     If FpSpread1.Sheets(0).ActiveRowIndex = 0 Then
          c = CType(FpSpread1.EditingControl, FarPoint.Win.FpCombo)
          AddHandler c.Click, AddressOf HeaderDoubleClick
     End If
End Sub

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback