VB.NET Programming

[VBNET] [API] Form - Animate

ZerosKD 2020. 4. 24. 17:07
반응형

 

* VBNET API 를 이용한 Form 생성 시 효과 나타 내기

 

 

Public Class Form1
    Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Integer, ByVal dwTime As Integer, ByVal dwFlags As Integer) As Boolean
    Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation.
    Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation.
    Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation.
    Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation.
    Const AW_CENTER = &H10 'Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
    Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown.
    Const AW_ACTIVATE = &H20000 'Activates the window.
    Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used.
    Const AW_BLEND = &H80000


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Center
        Dim frm As Form2 = New Form2()
        AnimateWindow(frm.Handle.ToInt32, 1000, AW_CENTER)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'AW_HOR_POSITIVE
        Dim frm As Form2 = New Form2()
        AnimateWindow(frm.Handle.ToInt32, 1000, AW_HOR_POSITIVE)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'AW_VER_POSITIVE
        Dim frm As Form2 = New Form2()
        AnimateWindow(frm.Handle.ToInt32, 1000, AW_VER_POSITIVE)
    End Sub
End Class
반응형