高手来看看这个右下角弹出程序代码

来源:百度知道 编辑:UC知道 时间:2024/06/20 16:53:31
Dim a%

Private Sub Form_Load()
Me.Move Screen.Width - Me.Width, Screen.Height
Timer1.Interval = 20
a = 0
End Sub
Private Sub Timer1_Timer()
Static i As Long
If a = 0 Then
If i >= Me.Height + 450 Then a = 2
Me.Move Screen.Width - Me.Width - 200, Screen.Height - i
i = i + 120
ElseIf a = 1 Then
If i <= 0 Then MsgBox "完成!": End
Me.Move Screen.Width - Me.Width - 200, Screen.Height - i
i = i - 120
ElseIf a = 2 Then
i = i + 10
If i >= 5500 Then a = 1: i = 4200
End If
End Sub

这段代码是右下角仿MSN消息弹出来的代码,
有没有方法改成渐显的效果呢?
就是屏幕右下角处有个小窗口渐渐以透明方式显示,而不是滑上方式。
然后10秒钟后又以渐淡方式消失,,,
希望好人提供个代码,谢谢!!!
不对啊,没效果呢,您能说得详细些吗?

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 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 Sub Timer1_Timer()
Dim rtn As Long
If Transparent < 255 Then
Transparent = Transparent + 1
End If

rtn = GetWindowLong(Me.hwnd, GWL_EXSTYLE) '取的窗口原先的样式
rtn = rtn Or WS_EX_LAYERED '使窗体添加上新的样式WS_EX_LAYERED
SetWindowLong Me.hwnd, GWL_EXSTYLE, rtn '把新的样式赋给窗体
SetLayeredWindowAttributes Me.hwnd, 0, Transparent, LWA_ALPHA + LWA_COLORKEY '将窗体显示为透明

End Sub
渐显代码,主要是SetLayeredWindowAttribut