关于
他们说要这样:
要用API
先添加一个模块~~ 代码如下:
Public Declare Function SetLayeredWindowAttributes Lib “user32” (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Const WS_EX_LAYERED = &H80000
Public Const GWL_EXSTYLE = (-20)
Public Const LWA_ALPHA = &H2
Public Const LWA_COLORKEY = &H1
Public Declare Function GetWindowLong Lib “user32” Alias “GetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib “user32” Alias “SetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Sub Form_Load()
Dim sty As Long
sty = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
sty = sty Or WS_EX_LAYERED
SetWindowLong Me.hwnd, GWL_EXSTYLE, sty
SetLayeredWindowAttributes Me.hwnd, 0, 192, LWA_ALPHA
End Sub
我试过可不行啊!的问题
这是一段很好的代码,你可将SetLayeredWindowAttributes Me.hwnd, 0, 192, LWA_ALPHA 修改为:
SetLayeredWindowAttributes Me.hwnd, 0, 12, LWA_ALPHA
再观看其窗体加载的效果.