RepositorySearchlookupedit防止在双击时显示编辑器

时间:2019-01-12 18:52:09

标签: devexpress

我有一个devexpress Xtragrid。

其中一列是RepositorySearchLookupedit。我正在使用双击事件来显示另一种形式。但是问题是,当我双击该列时,将显示编辑器,并且打开弹出窗口,然后触发双击事件。我想做的是,当用户双击时,不应打开弹出窗口,但如果单击一次,则应像往常一样打开弹出窗口。

为此,我使用Timer对象来区分单击和双击。

这是我的代码:

Dim allowopeneditor As Boolean
Private Sub timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
    CType(sender, Timer).Stop()

    Try
        allowopeneditor = True
        GridView20.ShowEditor()
    Finally
        allowopeneditor = False
    End Try
End Sub


Private Sub GridView20_DoubleClick(sender As Object, e As EventArgs) Handles GridView20.DoubleClick
    Dim p As Point = MousePosition
    Timer1.Stop()
    Dim view As GridView = CType(sender, GridView)
    Dim hitInfo As GridHitInfo = view.CalcHitInfo(view.GridControl.PointToClient(p))
    If hitInfo.InRowCell AndAlso sender.focusedcolumn Is col1 Then
        Myform1.Show()
    End If
End Sub

Private Sub GridView20_ShowingEditor(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles GridView20.ShowingEditor
            e.Cancel = sender.FocusedColumn Is col1 AndAlso Not allowopeneditor
End Sub

Private Sub GridView20_Click(sender As Object, e As EventArgs) Handles GridView20.Click
    Dim p As Point = MousePosition
    Dim view As GridView = CType(sender, GridView)
    Dim hitInfo As GridHitInfo = view.CalcHitInfo(view.GridControl.PointToClient(p))
    If hitInfo.InRowCell Then Timer1.Start()
End Sub

但是使用此代码,我得到奇怪的结果,有时双击不起作用且表单未打开,有时单击不起作用且存储库的弹出窗口未打开。

0 个答案:

没有答案
相关问题