📄 transwindow.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "TransWindow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
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 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 Const LWA_ALPHA = &H2&
Private Const GWL_STYLE = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Frm As Form
Private M As Menu
Private hwnd As Long
Private Const Du As Integer = 255
Private nStyle As Long
Public Sub UnLoadForm(Optional Speed As Double = 5)
For i = Du To 0 Step Speed * -1
DoEvents
SetLayeredWindowAttributes hwnd, 0, i, LWA_ALPHA
Next i
SetLayeredWindowAttributes hwnd, 0, 0, LWA_ALPHA
End Sub
Public Sub ShowForm(Optional Speed As Integer = 5)
For i = 0 To Du Step Speed
DoEvents
SetLayeredWindowAttributes hwnd, 0, i, LWA_ALPHA
Next i
SetLayeredWindowAttributes hwnd, 0, 255, LWA_ALPHA
End Sub
Public Sub SetForm(WindowhWnd As Form)
hwnd = WindowhWnd.hwnd
Set Frm = WindowhWnd
nStyle = GetWindowLong(hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, nStyle
SetLayeredWindowAttributes hwnd, 0, 0, LWA_ALPHA
Frm.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -