回复 3楼founderedu1的帖子
可以结合 EditStarting 和 EditEnd 事件来绕过这个问题,参考代码如下:
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- GeneralFormatter gf = new GeneralFormatter();
- gcSpreadSheet1.Sheets[0].Cells[0, 4].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, "#,##0.000 ");
- gcSpreadSheet1.Sheets[0].SetValue(0, 4, 12345678901234567890);
- gcSpreadSheet1.View.EditStarting += new EventHandler<GrapeCity.Windows.SpreadSheet.UI.EditCellStartingEventArgs>(View_EditStarting);
- gcSpreadSheet1.View.EditEnd += new EventHandler<GrapeCity.Windows.SpreadSheet.UI.EditCellEventArgs>(View_EditEnd);
- }
- void View_EditEnd(object sender, GrapeCity.Windows.SpreadSheet.UI.EditCellEventArgs e)
- {
- if (e.Row == 0 && e.Column == 4)
- {
- this.gcSpreadSheet1.View.UseFormatterForEditing = false;
- this.gcSpreadSheet1.ActiveSheet.DefaultStyle.Formatter = new GeneralFormatter("#,##0.000 ");
- }
- }
- void View_EditStarting(object sender, GrapeCity.Windows.SpreadSheet.UI.EditCellStartingEventArgs e)
- {
- if (e.Row == 0 && e.Column == 4)
- {
- this.gcSpreadSheet1.View.UseFormatterForEditing = true;
- this.gcSpreadSheet1.ActiveSheet.DefaultStyle.Formatter = new GeneralFormatter("#,##0.000 ");
- }
- }
复制代码 |