请教VB启动界面问题
我想做个软件的启动界面。想把他弄的漂亮些。所以准备了一个PNG图片(形状是一个圆角矩形有阴影)。想把这个PNG图片作为启动画面的图片。我思路是把窗体的透明度改成0,然后让窗体加载PNG。可是如何让窗体加载PNG图片我不会。请大家帮忙。或者大家有什么别的方法可以告诉我。我QQ:415580575.谢谢大家
[解决办法]
可以用这个API:
SetLayeredWindowAttributes
定义:
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll " (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
示例代码:
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
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 Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim Ret As Long
'Set the window style to 'Layered '
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
'Set the opacity of the layered window to 128
SetLayeredWindowAttributes Me.hWnd, -1, 128, LWA_ALPHA
End Sub