2

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

我知道如何处理和 之类的click事件double click。但我不知道如何处理long press.

任何帮助表示赞赏。

谢谢 :)

4

1 回答 1

3

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

嚼嚼:

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
于 2013-08-02T07:13:32.260 回答