Hello~下面是我的实现方法,代码生效,请对比- private void Form1_Load(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.CellType.ComboBoxCellType comboBoxCellType1 = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
- comboBoxCellType1.Items = (new String[] { "数据1", "数据2", });
- fpSpread1.Sheets[0].Cells[0, 0].CellType = comboBoxCellType1;
- comboBoxCellType1.EditorValueChanged += new EventHandler(comboBoxCellType1_EditorValueChanged);
- }
- void comboBoxCellType1_EditorValueChanged(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.CellType.ComboBoxCellType test = sender as FarPoint.Win.Spread.CellType.ComboBoxCellType;
- if (this.fpSpread1.Sheets[0].ActiveCell.Text == "数据1")
- {
- this.fpSpread1.Sheets[0].ActiveCell.ForeColor = Color.DarkOrange;
- }
- if (this.fpSpread1.Sheets[0].ActiveCell.Text == "数据2")
- {
- this.fpSpread1.Sheets[0].ActiveCell.BackColor = Color.DarkOrange;
- }
- }
复制代码 |