找回密码
 立即注册

QQ登录

只需一步,快速开始

a475207806

注册会员

5

主题

10

帖子

115

积分

注册会员

积分
115
a475207806
注册会员   /  发表于:2017-3-31 12:04  /   查看:3242  /  回复:3
本帖最后由 a475207806 于 2017-3-31 14:05 编辑

您好,这边想要实现这样一种方式,从Button1按Shift+Tab向后Tab到Spread的时候,全选当前文本框内的全部内容(不是设置HighLightText=True),这是大致的画面 blob931689758.png

附上Demo代码

PS:Inputman中像SelectionStart,SelectionLength在Spread的CellType中是如何对应的呢

追记:目前使用下面的代码勉强可以实现所需功能,但是有时会失灵
        Private Sub Button1_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles Button1.PreviewKeyDown
                If e.Shift And e.KeyCode = Keys.Tab Then
                        e.IsInputKey = True
                End If
        End Sub

        Private Sub Button1_KeyDown(sender As Object, e As KeyEventArgs) Handles Button1.KeyDown
                If e.Shift = True And e.KeyCode = Keys.Tab Then
                        FpSpread1.EditModeReplace = True
                        FpSpread1.Focus()
                        FpSpread1.EditModeReplace = False
                End If
        End Sub

WindowsApplication5.rar

11.55 KB, 下载次数: 105

3 个回复

倒序浏览
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-3-31 17:41:13
沙发
您是想只有从button 按了shift + tab 之后才进去编辑状态全选?其他行为获取焦点不进入编辑状态?
回复 使用道具 举报
a475207806
注册会员   /  发表于:2017-4-1 09:10:06
板凳
dexteryao 发表于 2017-3-31 17:41
您是想只有从button 按了shift + tab 之后才进去编辑状态全选?其他行为获取焦点不进入编辑状态?

默认是直接编辑状态,但是只有Shift+Tab才全选文本,其他情况下就是普通输入状态,昨天检查代码发现老系统还设置了个FocusPosition=FirstInputPosition,然后现在的代码这样写可以实现所需功能了
GcTextBoxCellType2.FocusPosition = GrapeCity.Win.Spread.InputMan.CellType.EditorBaseFocusCursorPosition.Inherit
                        FpSpread1.EditModeReplace = True
                        FpSpread1.Focus()
                        FpSpread1.EditModeReplace = False
                        GcTextBoxCellType2.FocusPosition = GrapeCity.Win.Spread.InputMan.CellType.EditorBaseFocusCursorPosition.FirstInputPosition

如果有更好的方法请提醒一下
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-4-1 18:12:44
地板
如果按您的需求,确实需要从buuton的事件中去操作,现在的做法应该没有问题
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部