请参考以下方法:
- public MainWindow()
- {
- InitializeComponent();
- gcSpreadSheet1.PreviewTextInput += new TextCompositionEventHandler(gcSpreadSheet1_PreviewTextInput);
- }
- void gcSpreadSheet1_PreviewTextInput(object sender, TextCompositionEventArgs e)
- {
- if (gcSpreadSheet1.ActiveSheet.ActiveColumnIndex == 1)
- {
- (e.OriginalSource as GrapeCity.Windows.SpreadSheet.UI.EditingElement).MaxLength = 5;
- }
- }
复制代码 |