Sunday, February 6, 2011

Moving texts using timer component

Hi guys! this is the sample code of the moving text using the timer component. hope this will help..
Happy coding! :)

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Label1.Left = 0
Label1.Top = 0
Timer1.Interval = 10
End Sub

Private Sub Timer1_Timer()
If Label1.Top = 0 Then
    Label1.Left = Label1.Left + 10
End If
If Label1.Left = 5000 Then
    Label1.Top = Label1.Top + 10
End If
If Label1.Top = 5000 Then
    Label1.Left = Label1.Left - 10
End If
If Label1.Left = 0 Then
    Label1.Top = Label1.Top - 10
End If
End Sub

No comments:

Post a Comment