
标题: [ZT][VB]半透明窗体 [打印本页]
作者: 最美我中文 时间: 2007-9-2 13:19 标题: [ZT][VB]半透明窗体
半透明窗体
作者:不详 来源于:中国VB网 发布时间:2004-12-2
'将下面的程序代码复制到窗体中即可
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 GetWindowLong Lib "user32" _
Alias "GetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long) _
As Long
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA As Long = &H2
Private Const WS_EX_LAYERED As Long = &H80000
Private Declare Function SetLayeredWindowAttributes Lib "user32" _
(ByVal hwnd As Long, _
ByVal crKey As Long, _
ByVal bAlpha As Long, _
ByVal dwFlags As Long) _
As Long
Private Sub Form_Load()
Dim p As Long
p = GetWindowLong(Me.hwnd, GWL_EXSTYLE) '取得当前窗口属性
Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, p Or WS_EX_LAYERED)
'加上一个透明属性
'0为完全透明,下面是设为200时的透明效果,可自行修改
Call SetLayeredWindowAttributes(Me.hwnd, 0, 200, LWA_ALPHA)
End Sub
作者: 深红喷火龙 时间: 2007-9-29 12:27
[quote]原帖由 Woodu 于 2007-9-2 01:19 PM 发表
Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, p Or WS_EX_LAYERED)
'加上一个透明属性
'0为完全透明,下面是设为200时的透明效果,可自行修改
Call SetLayeredWindowAttributes(Me.hwnd, 0, 200, LWA_ALPHA) [quote]
这里为什么要用call呢?不明白…………
望楼主明示
Private Const LWA_ALPHA As Long = &H2
Private Const WS_EX_LAYERED As Long = &H80000
这两句………………是vb2005的吗?
[ 本帖最后由 深红喷火龙 于 2007-9-29 12:35 PM 编辑 ]
作者: youd 时间: 2007-9-29 13:42
VB6.0的
这个代码挺有意思的,下次用指数计算器上~~
作者: 最美我中文 时间: 2007-9-29 17:50
哦……两位考古= =
算了= =
转的,至于用Call调用那个参数
然后是For VB6调试通过(Under win2k/xp/2003)
作者: roywillow 时间: 2007-10-1 18:58
好玩好玩好玩玩……
![[yct2]](/bbs/images/smilies/yct/2.gif)
![[yct2]](/bbs/images/smilies/yct/2.gif)
![[yct2]](/bbs/images/smilies/yct/2.gif)
![[yct14]](/bbs/images/smilies/yct/14.gif)
![[yct14]](/bbs/images/smilies/yct/14.gif)
[yct14][yct14]设置透明度的数值有没有范围?好像超过一定的数就开始循环……
PS:窗体透明,里面的控件呢?
作者: 最美我中文 时间: 2007-10-1 19:32
自己动手~丰衣足食~
作者: youd 时间: 2007-10-1 19:52
控件同样透明化了
作者: 最美我中文 时间: 2007-10-1 20:01
麻烦死你= =
而且很不实用
作者: roywillow 时间: 2007-10-2 11:16
很麻烦吗?
PS:要是能用Vista窗体的框框就好了……
作者: 最美我中文 时间: 2007-10-2 11:46
无比鄙视Vista的Aero
因为这使我们这些老爷机们……省略
| 欢迎光临 口袋社区-Poke The BBS (https://poketb.com/bbs/) | Powered by Discuz! 6.1.0F |