VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This will make a command button bounce on the form and it fits to the forms width and height when y

by GodsouL (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 12th April 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This will make a command button bounce on the form and it fits to the forms width and height when you resize it.

API Declarations



Extra:
Command button is the object that bounces, change it if you want.
Also you can add more objects and make them bounce but for each object you will need 4 timers

Rate This will make a command button bounce on the form and it fits to the forms width and height when y



Command1.Left = Command1.Left + 100
If Command1.Left >= Me.Width - Command1.Width - 100 Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub

Private Sub Timer2_Timer()
Command1.Left = Command1.Left - 100
If Command1.Left <= 0 Then
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub

Private Sub Timer3_Timer()
Command1.Top = Command1.Top + 100
If Command1.Top >= Me.Height - Command1.Height - Command1.Height - 175 Then
Timer3.Enabled = False
Timer4.Enabled = True
End If
End Sub

Private Sub Timer4_Timer()
Command1.Top = Command1.Top - 100
If Command1.Top <= 0 Then
Timer3.Enabled = True
Timer4.Enabled = False
End If
End Sub

Download this snippet    Add to My Saved Code

This will make a command button bounce on the form and it fits to the forms width and height when y Comments

No comments have been posted about This will make a command button bounce on the form and it fits to the forms width and height when y. Why not be the first to post a comment about This will make a command button bounce on the form and it fits to the forms width and height when y.

Post your comment

Subject:
Message:
0/1000 characters