找回密码
 立即注册

QQ登录

只需一步,快速开始

merciful

论坛元老

18

主题

46

帖子

4982

积分

论坛元老

积分
4982

活字格认证

merciful
论坛元老   /  发表于:2011-9-29 14:18  /   查看:5922  /  回复:5
EditMode=EditOnShortcutKey时,默认双击单元格的时候,单元格进入编辑状态。
如何能解除这个开始编辑动作,只是触发我写在双击事件中的代码。
谢谢!

5 个回复

倒序浏览
robert
金牌服务用户   /  发表于:2011-9-29 14:54:00
沙发
挂CellBeginEdit事件,判断如果是BeginEditReason是MouseActions 就Cancel
  1. Private Sub gcMultiRow1_CellBeginEdit(sender As Object, e As CellBeginEditEventArgs)
  2.         If e.BeginEditReason = BeginEditReason.MouseActions Then
  3.                 e.Cancel = True
  4.         End If
  5. End Sub
复制代码
回复 使用道具 举报
merciful
论坛元老   /  发表于:2011-10-12 10:48:00
板凳

回复 2# robert 的帖子

很感谢回答。但是,这个方法有个问题,就是如果单元格是combobox或者popupcell的情况下,鼠标单击控件也无法启动编辑。我只想屏蔽双击,是否能做到?
回复 使用道具 举报
robert
金牌服务用户   /  发表于:2011-10-12 11:11:00
地板
不好意思,没有办法判断是否是双击。判断是否是特定Cell来决定是否取消编辑,希望可能满足你的需求。
  1. Private Sub gcMultiRow1_CellBeginEdit(sender As Object, e As CellBeginEditEventArgs)
  2.         If e.CellName = "checkBoxCell1" Or e.CellName = "comboBoxCell1" Then
  3.             Return
  4.         End If
  5.         If e.BeginEditReason = BeginEditReason.MouseActions Then
  6.                 e.Cancel = True
  7.         End If
  8. End Sub
复制代码
回复 使用道具 举报
merciful
论坛元老   /  发表于:2011-10-12 12:06:00
5#
谢谢
回复 使用道具 举报
robert
金牌服务用户   /  发表于:2011-10-12 13:34:00
6#
不客气,有什么问题欢迎继续发帖讨论
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部