15211598002 你好,
我对该 Case 的理解是,如果第一列为 ComboBoxCellType ,那么在第一列点击"回车键",光标自动跳转到同行的下一列单元格。实现方法如下:
- private void Form1_Load(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.CellType.ComboBoxCellType cmbocell = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
- cmbocell.Items = (new String[] { "January", "February", "March", "April", "May", "June" });
- cmbocell.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.AllArrows;
- cmbocell.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter;
- cmbocell.Editable = true;
- cmbocell.ListAlignment = FarPoint.Win.ListAlignment.Left;
- cmbocell.ListOffset = 20;
- cmbocell.ListWidth = 0;
- cmbocell.MaxDrop = 4;
- fpSpread1.Sheets[0].Columns[0].CellType = cmbocell;
- }
- private void fpSpread1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (this.fpSpread1.Sheets[0].ActiveColumnIndex==0)
- {
- if (e.KeyChar.ToString() == "\r")
- {
- this.fpSpread1.Sheets[0].SetActiveCell(this.fpSpread1.Sheets[0].ActiveRowIndex, this.fpSpread1.Sheets[0].ActiveColumnIndex + 1);
- }
- }
- }
复制代码 |