VB窗体透明控件不透明代码


(文章ID:260)|(编辑:isen)|(点击次数:1961)|(添加时间:2013-03-30 10:10:08)|(添加IP:182.135.189.127)

    '可以将窗体BorderStyle属性设为0

    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()

     Me.BackColor = &HFF0000

     Dim rtn As Long

     Dim BorderStyler

     BorderStyler = 0

     rtn = GetWindowLong(hwnd, GWL_EXSTYLE)

     rtn = rtn Or WS_EX_LAYERED

     SetWindowLong hwnd, GWL_EXSTYLE, rtn

     SetLayeredWindowAttributes hwnd, &HFF0000, 0, LWA_COLORKEY

    End Sub

    



·上一篇:简阳市康乐幼儿园网站开通,敬请关注...
·下一篇:vb获取农历日期信息

粤ICP备13075271号  | Copyright © 2024 Isen Software Studio - 一森软件工作室  |  Designed by www.isennet.com  | 站长入口