Membuat Arah Form Bergerak di VB 6.0

Pertama-tama Buatlah 1 form baru Lalu copy coding di bawah ini:
Private Sub Form_Unload(Cancel As Integer)
'Koding untuk bergerak ke kiri
Let garisX = Screen.TwipsPerPixelX
Let garisX = Screen.TwipsPerPixelY
If Form1.WindowState = 0 Then
While Form1.Left > 0
  Form1.Left = Form1.Left - garisX
  Wend
  Else
  Call MsgBox("WRONG!", vbInformation, "ERROR")
  End If
 
  'form bergerak ke kanan
  Let garisX = Screen.TwipsPerPixelX
Let garisX = Screen.TwipsPerPixelY
If Form1.WindowState = 0 Then
While Form1.Left + Form1.Width < Screen.Width
  Form1.Left = Form1.Left + garisX
  Wend
  Else
  Call MsgBox("WRONG!", vbInformation, "ERROR")
  End If
 
  'form bergerak ke bawah
  Let garisX = Screen.TwipsPerPixelX
Let garisX = Screen.TwipsPerPixelY
If Form1.WindowState = 0 Then
While Form1.Top + Form1.Width < Screen.Width
  Form1.Top = Form1.Top + garisX
  Wend
  Else
  Call MsgBox("WRONG!", vbInformation, "ERROR")
  End If
 
  ' form bergerak ke atas
On Error Resume Next
Do Until Me.Top <= -5000
    DoEvents
    Me.Move Me.Left, Me.Top - 10
    DoEvents
Loop
Unload Me
End Sub

SEMOGA BERMANFAAT.....!!!

0 comments: