展开全部
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal HWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal HWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal HWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
Private Sub Form_Load()
SetWinAlpha 0
Timer1.Interval = 30
Timer1.Enabled = True
End Sub
Sub SetWinAlpha(a As Byte)
SetWindowLong Me.HWnd, GWL_EXSTYLE, GetWindowLong(Me.HWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.HWnd, 0, a, LWA_ALPHA
End Sub
Private Sub Timer1_Timer()
Static a As Byte
If a >= 255 Then
SetWinAlpha 255
Timer1.Enabled = False
Else
SetWinAlpha a
a = a + 5
End If
End Sub
以上代码涉及控件:Timer1
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询