比如在vb.net中,在mousehover中写button.performclick(),当鼠标移进按钮,按钮就被自动点开了。
问题是vb里面没有performclick(),那应该怎么写,才能实现自动点开的功能呢?

解决方案 »

  1.   

    Option Explicit
    Private bMouseInButton As BooleanPrivate Sub Command1_Click()
        Timer1.Enabled = False
        MsgBox "Click"
    End SubPrivate Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        bMouseInButton = True
        Timer1.Enabled = False
        Timer1.Enabled = True
    End SubPrivate Sub Form_Load()
        Timer1.Enabled = False
        Timer1.Interval = 1000 'MouseHover 延时
    End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        bMouseInButton = False
        Timer1.Enabled = False
    End SubPrivate Sub Timer1_Timer()
        Timer1.Enabled = False
        Command1.Value = True '触发 Command1_Click
    End Sub