半透明窗体

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




'引用http://www.chinavb.net/Article.Asp?id=553


[本日志由 admin 于 2008-05-21 05:06 PM 编辑]
文章来自: 本站原创
引用通告地址: http://www.is21.cn/trackback.asp?tbID=330
Tags:
评论: 0 | 引用: 0 | 查看次数: 2373
发表评论
你没有权限发表留言!