vb.net datagridview中longpress的事件是什么

时间:2013-08-02 07:06:56

标签: vb.net winforms events mouseevent

如何在vb.net的datagridview中的单元格/行中处理long press

我知道如何处理clickdouble click等事件。但我不知道如何处理long press

感谢任何帮助。

谢谢:)

1 个答案:

答案 0 :(得分:2)

你应该在鼠标按下事件上启动一个计时器,在鼠标按下事件上停止它,然后得出结论:)

周咀:

Private ClickTime As DateTime

Private Sub DataGridView1_MouseDown(sender As Object, e As MouseEventArgs) Handles DataGridView1.MouseDown
    ClickTime = Now
End Sub

Private Sub DataGridView1_MouseUp(sender As Object, e As MouseEventArgs) Handles DataGridView1.MouseUp
    If (Now - ClickTime).TotalMilliseconds > 500 Then MsgBox("LongClick")
End Sub