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
发表评论: