VB150例_Example002-半透明窗口

[复制链接]
查看1881 | 回复3 | 2006-7-3 13:27:00 | 显示全部楼层 |阅读模式

VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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)
'加上一个透明属性
'Call SetLayeredWindowAttributes(Me.hwnd, 0, 0, LWA_ALPHA)
End Sub
源码下载:

[replyview] [upload=rar]viewFile.asp?ID=18[/upload]
[/replyview]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册哦

x
xuliang987 | 2007-5-16 20:22:00 | 显示全部楼层
学习中
hudz2239 | 2009-12-10 00:42:00 | 显示全部楼层
新手学习多谢
kafyzzx | 2009-12-10 20:59:00 | 显示全部楼层
学习学习
您需要登录后才可以回帖 登录 | 注册哦

本版积分规则