[c++] VB 窗体透明度

[复制链接]
梅雷工具箱发表于 2015-6-25 13:22:47 | 显示全部楼层 |阅读模式
VB 窗体透明度


’声明
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 Const WS_EX_LAYERED = &H80000 '此声明部分为一行
Private Const GWL_EXSTYLE = (-20) '此声明部分为一行
Private Const LWA_ALPHA = &H2 '此声明部分为一行
Private Const LWA_COLORKEY = &H1 '此声明部分为一行

Private Sub Form_Load()
Dim rtn As Long
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, 0, 100, LWA_ALPHA '0为完全透明,255为不透明。
End Sub
_____________________________________________________________________________ _

中磊UG二次开发教程 梅雷著 qq1821117007
学UG就上UG网 http://www.9sug.com/
就上UG网淘宝直营店
您需要登录后才可以回帖 登录 | 注册UG网 用百度帐号登录

本版积分规则