回复 1楼deppp的帖子
无法直接设置,但是可以通过以下代码来限制:
- private void Form1_Load(object sender, EventArgs e)
- {
- fpSpread1.ActiveSheet.Columns[0].CellType = new FarPoint.Win.Spread.CellType.TextCellType();
- fpSpread1.EditModeOn += new EventHandler(fpSpread1_EditModeOn);
- }
- void fpSpread1_EditModeOn(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.CellType.GeneralEditor ge = fpSpread1.EditingControl as FarPoint.Win.Spread.CellType.GeneralEditor;
- ge.KeyPress -= new KeyPressEventHandler(ge_KeyPress);
- ge.KeyPress += new KeyPressEventHandler(ge_KeyPress);
- }
- void ge_KeyPress(object sender, KeyPressEventArgs e)
- {
- FarPoint.Win.Spread.CellType.GeneralEditor ge = sender as FarPoint.Win.Spread.CellType.GeneralEditor;
- int count = System.Text.Encoding.Default.GetByteCount(ge.Text);
- if (true)
- {
- e.Handled = true;
- }
- }
复制代码 |