VB 2008 高手请进! 高分

来源:百度知道 编辑:UC知道 时间:2024/06/12 23:38:02
我想让一个 Form 在 load 的时候, 一个 picturebox 中的图片的透明度不断改变,时而变大,时而变小,一直持续下去。好像呼吸灯一样的效果。 有点神秘的感觉,
我知道要用到 timer ,但是其他的代码我不懂啊~

请大家赐教吧

API声明放在模块里
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, _
ByVal crKey As Long, ByVal bAlpha As Long, ByVal dwFlags As Long) As Long

Public Const GetWinLStyle = (-20)
Public Const WinAlpha = &H2
Public Const ColorSet = &H1
Public Const SetWinLLay = &H80000

以下代码放在FORM_LOAD中
PICTUREBOX 名称为PCB
Dim NowStyle As Long
NowStyle = GetWindowLong(PCB.hWnd, GetWinLStyle) '取得当前窗口属性
Call SetWindowLong(PCB.hWnd, GetWinLStyle, NowStyle Or SetWinLLay)
'加上一个透明属性
Call SetLayere