调用双击鼠标单击

时间:2012-03-11 12:43:32

标签: vb.net double-click mouseclick-event

我们如何调用单击鼠标单击事件?我这样做,但它不起作用。有什么想法吗?

Private Sub RichTextBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseClick
    RichTextBox1_MouseDoubleClick(sender, e)
End Sub

3 个答案:

答案 0 :(得分:0)

在属性窗口中单击“事件图标”并找到双击并在所选事件名称中选择“RichTextBox1_MouseClick”

答案 1 :(得分:0)

你试过了吗?

Private Sub RichTextBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseClick, RichTextBox1.MouseDoubleClick, RichTextBox1.DoubleClick
    'Do stuff here
End Sub

答案 2 :(得分:0)

基本上有两种选择。第一个是你如何做,点击仍然可以做更多以及双击。

Private Sub RichTextBox1_MouseClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseClick
    '' i can do stuff here
    RichTextBox1_MouseDoubleClick(sender, e)
    '' and here

    '' as well as do whatever double click is doing

End Sub

Private Sub RichTextBox1_MouseDoubleClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseDoubleClick
    '' to do something here
End Sub

另一种选择,如果他们总是这样做,你可以这样做:

Private Sub RichTextBox1_Single_DoubleClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseClick, RichTextBox1.MouseDoubleClick
    '' do something here
End Sub

注意最后的第二个Handles位?该函数现在可以处理:)

要么你应该做得很好。