回复 8楼qd98zhq的帖子
请使用以下代码捕获单元格编辑事件:
- public MainWindow()
- {
- InitializeComponent();
- this.spread.View.EditStarting += View_EditStarting;
- this.spread.View.EditEnd += View_EditEnd;
- }
- void View_EditEnd(object sender, EditCellEventArgs e)
- {
- (this.spread.View.CellEditor as TextBox).RemoveHandler(TextBox.MouseLeftButtonDownEvent, (MouseButtonEventHandler)this.MainPage_MouseLeftButtonDown);
- (this.spread.View.CellEditor as TextBox).KeyDown -= MainWindow_KeyDown;
- }
-
- void View_EditStarting(object sender, EditCellStartingEventArgs e)
- {
- (this.spread.View.CellEditor as TextBox).AddHandler(TextBox.MouseLeftButtonDownEvent, (MouseButtonEventHandler)this.MainPage_MouseLeftButtonDown, true);
- (this.spread.View.CellEditor as TextBox).KeyDown += MainWindow_KeyDown;
- }
-
- void MainPage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
-
- }
-
- void MainWindow_KeyDown(object sender, KeyEventArgs e)
- {
-
- }
复制代码
关于弹出位置的计算,可以通过当前活跃单元格信息获取。 |