VB实现窗口透明效果,测试OK - 洛阳翼展电脑


VB实现窗口透明效果,测试OK

2023-7-7 乱云飞

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
Const GWL_EXSTYLE = -20
Const WS_EX_LAYERED = &H80000
Const LWA_ALPHA = &H2
Private Sub Form_Load()
    Dim hwnd As Long
    hwnd = Me.hwnd    
    SetWindowLong hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED  '设置窗体样式为 Layered
    SetLayeredWindowAttributes hwnd, 0, 128, LWA_ALPHA  '设置窗体为透明
End Sub
本文链接:http://80c.cc/ez/682.html
0

发表评论:

VirtualCamera:在录像机中虚拟一个通道显示电脑桌面、视频文件、USB摄像头~
预ICP备10086-001号 © 翼展网/80C.CC 技术支持/洛阳翼展科技
TEL / 13213610060 QQ / 345794501
Powered by emlog