【文件属性】:
文件名称:透明窗体透明控件
文件大小:152KB
文件格式:EXE
更新时间:2015-08-25 12:19:18
透明
透明效果测试
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 asPopup1_Click(Cancel As Boolean)
If Text1.BackColor = vbBlue Then
Text1.BackColor = vbWhite
Else
Text1.BackColor = vbBlue
End If
End Sub
Private Sub asPopup2_Click(Cancel As Boolean)
If Me.BackColor = vbBlue Then
Me.BackColor = vbWhite
Else
Me.BackColor = vbBlue
End If
End Sub
Private Sub Form_Load()
Text1.Width = Form1.Width
Text1.Top = 0
Text1.Left = 0
asPopup2.Height = asPopup1.Height
asPopup2.Width = asPopup1.Width
asPopup2.Top = asPopup1.Top
Text1.Text = Chr(13) + " QS-HJC "
Me.BackColor = vbWhite
Dim rtn As Long
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, vbBlue, 0, LWA_COLORKEY
End Sub