1. Trik Form Muncul dari Atas Ke Bawah
‘Kode Keluar / Close
Private Sub Command1_Click()
Timer2.Interval = 1
End Sub
‘mengatur posisi awal form
Private Sub Form_Load()
Me.Left = 100
Me.Top = 1
Timer1.Interval = 1
End Sub
‘kode form Masuk
Private Sub Timer1_Timer()
If Me.Top >= Screen.Height - (Height + 500) Then
Timer1.Interval = 0
Else
Me.Top = Me.Top + 100
End If
End Sub
‘Kode form keluar / Unload
Private Sub Timer2_Timer()
If Me.Top = 1 Then
Unload Me
Else
Me.Top = Me.Top - 100
End If
End Sub
2. Trik Form Muncul dari Kiri ke Tengah keluar ke kanan
Dim Tengah As Integer
‘kode form Kelauar / Close
Private Sub Command1_Click()
Timer2.Interval = 1
End Sub
‘Mengatur posisi awal form
Private Sub Form_Load()
Me.Top = 100
Tengah = (Screen.Width - Me.Width) / 2
Me.Left = 1
Timer1.Interval = 1
End Sub
‘ Kode form Masuk
Private Sub Timer1_Timer()
If Me.Left <= Tengah Then
Me.Left = Me.Left + 100
Else
Me.Timer1.Interval = 0
End If
End Sub
‘Kode form Kelaur/ Unload
Private Sub Timer2_Timer()
If Me.Left >= Screen.Width Then
Unload Me
Else
Me.Left = Me.Left + 100
End If
End Sub
3. Trik form Muncul dari atas ke Tangah keluar ke Bawah
Code:
Dim postengah As Integer
‘ Kode Keluar / Close
Private Sub Command1_Click()
postengah = Me.Top
Me.Top = Me.Top + 10
Me.Timer2.Interval = 50
End Sub
‘Mengatur Posisi Awal Form
Private Sub Form_Load()
Me.Top = Me.Height * -1
Me.Left = (Screen.Width - Me.Width) / 2
postengah = (Screen.Height - Me.Height) / 2
Me.Timer1.Interval = 50
End Sub
‘Kode fom masuk
Private Sub Timer1_Timer()
If Me.Top < postengah Then
Me.Top = Me.Top + ((postengah - Me.Top) / 2)
Else
Me.Top = postengah
Me.Timer1.Interval = 0
End If
End Sub
‘Kode form Keluar
Private Sub Timer2_Timer()
If Me.Top < Screen.Height Then
Me.Top = Me.Top + ((Me.Top - postengah) * 2)
Else
Unload Me
End If
End Sub
4. Trik Form muncul dari Kiri atas ke Kanan bawah
‘Kode tombol Keluar / Close
Private Sub Command1_Click()
Timer2.Interval = 1
End Sub
‘Mengatur Posisi Awal form
Private Sub Form_Load()
Me.Top = 1
Me.Left = 1
Timer1.Interval = 1
End Sub
‘Kode form masuk/ Show
Private Sub Timer1_Timer()
If Me.Top >= (Screen.Height - (Me.Height + 500)) Then
Timer1.Interval = 0
Else
Me.Top = Me.Top + 100
Me.Left = Me.Left + 100
End If
End Sub
‘kode form keluar/ Unload
Private Sub Timer2_Timer()
If Me.Top <= 1 Then
Unload Me
Else
Me.Top = Me.Top - 100
Me.Left = Me.Left + 100
End If
terima kasih Sensei ilmu Nya,,
BalasHapus