How To Make Your Form Shake In VB.NET




Use this code to make a form shake. It is fun to use and can be used under any event.

codes :

'By LeSaN
'Easy code to make a form shake

Dim a As Integer 'Declaring integer "a"

While a < 10 'Starting a "while loop"

'Setting our form's X position to 20 'pixels to right from it's current position.            
Me.Location = New Point(Me.Location.X + 20, Me.Location.Y)
            
'Telling a program to sleep for 50 miliseconds before 'continuing
System.Threading.Thread.Sleep(50)

'Setting our form's X position to 20 'pixels to left from it's current position.
Me.Location = New Point(Me.Location.X - 20, Me.Location.Y)

'Telling a program to sleep for 50 miliseconds before continuing            
System.Threading.Thread.Sleep(50)
            
a += 1 'Increasing integer "a" by 1 after each loop
        
End While


Here is a preview:



--------------------------------------------------------------------------------------

1 comments:

Post a Comment

Note: Only a member of this blog may post a comment.