怎么在鼠标移开窗体时隐藏窗体?反之显示窗体。vb
展开全部
Private Declare Function GetWindowLong Lib"user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByValnIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias"SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByValdwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32 "(ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlagsAs Long) As Long
Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long)As Long ')
Private Declare Function ReleaseCapture Lib "user32" () As Long ' ')
Dim Layered As Boolean
Private Sub Form_Load()
SetWindowLong hWnd, (-20), GetWindowLong(hWnd, (-20)) Or&H80000
SetLayeredWindowAttributes hWnd, 0, 255, 2
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, YAs Single)
If (X < 0) Or (Y < 0) Or (X > ScaleWidth) Or (Y> ScaleHeight) Then
ReleaseCapture
For i = 255 To 1 Step -1
SetLayeredWindowAttributes hWnd, 0, i, 2
Next
Layered = True
Else
SetCapture hWnd
If Layered Then
For i = 1 To255 Step 1
SetLayeredWindowAttributes hWnd, 0, i, 2
Next
Layered =False
End If
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询