【VB技巧】VB Form 窗体实现淡入淡出的效果

  • A+
所属分类:lcx

    VB Form 窗体实现淡入淡出的效果,VB Form 窗体实现淡入淡出效果,VB Form 窗体淡入淡出的效果,VB Form 实现淡入淡出的效果,VB 窗体实现淡入淡出的效果,VB Form 窗体淡入淡出效果,VB Form 实现淡入淡出效果,VB Form 窗体淡入淡出效果,VB 窗体实现淡入淡出效果,VB Form 淡入淡出的效果,VB 窗体淡入淡出的效果,VB Form 窗体淡入淡出,VB Form 淡入淡出,VB 窗体 淡入淡出,VB 淡入淡出效果,VB 淡入淡出。

VB Form 窗体实现淡入淡出效果代码:

Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Boolean
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 WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2

Private Sub Form_Load()
    SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
    Me.Show
    lwa_FadeIn Me.hWnd, 1
End Sub

Private Sub Form_Unload(Cancel As Integer)
    lwa_FadeOut Me.hWnd, 1
    End
End Sub

Private Sub lwa_FadeIn(ByVal hWnd As Long, Optional ByVal iStep As Integer = 1)
    Dim bAlpha As Integer
    bAlpha = 0
    While bAlpha
        If bAlpha > 255 Then bAlpha = 255
        SetLayeredWindowAttributes hWnd, 0, bAlpha, LWA_ALPHA
        DoEvents
        bAlpha = bAlpha + iStep
    Wend
End Sub

Private Sub lwa_FadeOut(ByVal hWnd As Long, Optional ByVal iStep As Integer = 1)
    Dim bAlpha As Integer
    bAlpha = 255
    While bAlpha > 0
        If bAlpha
        SetLayeredWindowAttributes hWnd, 0, bAlpha, LWA_ALPHA
        DoEvents
        bAlpha = bAlpha - iStep
    Wend
End Sub

文章来源于lcx.cc:【VB技巧】VB Form 窗体实现淡入淡出的效果

相关推荐: 利用声学密码分析攻击破译4096位RSA加密算法

引言:计算机科学家开发出了一种可靠提取密钥的新攻击技术:捕捉计算机在展示加密信息时产生的高声调音频。这项密码破解技术(PDF)属于物理攻击,攻击者需要将智能手机的麦克风直接对准目标计算机的风扇通风口,但研究人员提出可以用监听声音的恶意程序感染智能手机,或者其它…

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: