Trik Form di Visual Basic 6.0

berikut ini trik2 form yg ada pada visual basic 6.0… cekidot… :)

1. Trik Form muncul dari Kanan ke Kiri
Coding:
=================================================================
‘Kode Keluar /Close
Private Sub Command1_Click()
Timer2.Interval = 1
End Sub

‘mengatur posisi awal form
Private Sub Form_Load()
Me.Top = (Screen.Height – Height) / 2
Me.Left = (Screen.Width – Width) / 1
Timer1.Interval = 1
End Sub

‘kode form muncul
Private Sub Timer1_Timer()
If Me.Left <= 100 Then
Timer1.Interval = 0
Else
Me.Left = Me.Left – 100
End If
End Sub

‘Kode form keluar
Private Sub Timer2_Timer()
If Me.Left >= Screen.Width Then
Unload Me
Else
Me.Left = Me.Left + 100
End If
End Sub
=================================================================
2. Trik Form tampil dari Kiri ke Kanan

‘Kode tombol Keluar / Close
Private Sub Command1_Click()
Timer2.Interval = 1
End Sub

‘mengatur posisi awal form
Private Sub Form_Load()
Me.Top = (Screen.Height – Height) / 2
Me.Left = 1
Timer1.Interval = 1
End Sub

‘Kode form untuk Muncul
Private Sub Timer1_Timer()
If Me.Left >= (Screen.Width – Me.Width) Then
Timer1.Interval = 0
Else
Me.Left = Me.Left + 100
End If
End Sub

‘kode form Untuk Keluar /Unload
Private Sub Timer2_Timer()
If Me.Left <= 100 Then
Unload Me
Else
Me.Left = Me.Left – 100
End If
End Sub
======================================================================
3. Trik Form Muncul Dari Bawah ke atas

‘Kode form Keluar /Close
Sub Command1_Click()
Timer2.Interval = 1
End Sub

‘mengatur posisi awal form
Private Sub Form_Load()
Me.Left = 100
Me.Top = Screen.Height
Timer1.Interval = 1
End Sub

‘Kode form tampil
Private Sub Timer1_Timer()
If Me.Top <= 10 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 >= Screen.Height Then
Unload Me
Else
Me.Top = Me.Top + 100
End If
End Sub
========================================================
4. 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

5. 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
========================================================================
6. Trik form Muncul dari atas ke Tangah keluar ke Bawah

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

7. 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
End Sub
==========================================================

semoga bermanfaat…. #keep share 8-) :D :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s