.Net中的cell 如果设置celltype是Combo,那么可以用Cell的getValue方法获取到Combo的选中值,当用户选择了Combo,cell的value就会发生变化。和界面时同步的。
- FarPoint.Win.Spread.CellType.ComboBoxCellType combo = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
- private void Form1_Load(object sender, System.EventArgs e)
- {
- string[] cbstr;
- cbstr = new String[] {"One", "Two", "Three"};
- string[] strval;
- strval = new String[] {"1", "2", "3"};
- combo.Items = cbstr;
- combo.ItemData = strval;
- combo.EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData;
- fpSpread1.Sheets[0].Cells[0, 0].CellType = combo;
- }
- private void fpSpread1_ComboSelChange(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
- {
- textBox1.Text = fpSpread1.Sheets[0].Cells[0, 0].Value.ToString();
- }
复制代码 |