vb6.0怎么显示隐藏的窗体,都来看看吧。
发布网友
发布时间:2023-12-29 09:07
我来回答
共2个回答
热心网友
时间:2024-01-17 23:04
添加个timer
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer '全局热键声明
Private Sub Form_Load()
Timer1.Interval = "100" '设定时间, 如果太小的话,程序该来回慌了
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyMenu) and GetAsyncKeyState(vbKeyA) Then ' 检查是否按下Alt+A键
If Form1.Visible = True Then
Form1.Visible = False '或 form1.hide
ElseIf Form1.Visible = False Then
Form1.Visible = True '或 form1.show
End If
End If
End Sub
如果你要按键组合:
If GetAsyncKeyState(vbKeyF12) And GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKeyMenu) Then'其中的(vbkey)就是按键码,,,(vbkeycontrol)代表Ctrl键
(vbKeyMenu)代表Alt键
热心网友
时间:2024-01-17 23:05
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKeyA) Then
If Form1.Visible = False Then
Form1.Visible = True
Else
Form1.Visible = False
End If
End If
End Sub