vb 透明窗体

来源:百度知道 编辑:UC知道 时间:2024/06/15 20:22:50
用VB做个透窗体,是绝对透明啊,可以移动的。
另外Label1 里的字不能透明。而且设置绿色后不能有蓝边 ,这样的功能如果实现?谢谢各位!
三楼的不行啊!。。

'-----------------------------------窗体透明(不规则窗体)的模块-------------------------------------------------------
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
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

'Form 中

'rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
'rtn = rtn Or WS_EX_LAYERED
'SetWindowLong hwnd, GWL_EXSTYLE, rtn
'SetLayeredWindowAttributes hwnd, RGB(0, 0, 0), 0, LWA_COLOR