VB - Nudge(MSN)
In this tutorial I'll teach you how to make your form 'nudge' like in windows live messenger.
Start by creating a new windows form application and name it nudger.
Add a button:
Set the text to Nudge and double click the button.
You'll need to make a function for this to work. Make it underneath the code of the button , don't make it in the sub of the button !
(See image)
add the following codes to the Function (buzz):
Dim locOrX, locOrY As Integer
Dim nloc As Point
Dim oloc As Point
locOrX = Me.Location.X
locOrY = Me.Location.Y
oloc.X = locOrX
oloc.Y = locOrY
nloc.X = locOrX + 5
nloc.Y = locOrY - 5
Me.Location = nloc
Threading.Thread.Sleep(100)
Me.Location = oloc
Return oloc 'optional...
Your code should look like this:
Now, add 2 timers and add the following codes to timer1:
Buzz()
And add the following codes to timer2:
Timer1.Stop()
Timer2.Stop()
Go back to the design of your form and set the timer1 propertie 'Interval' to 120
Set timer2 interval to 1000:
Double click the button again, and add the following codes to the button:
Timer1.Start()
Timer2.Start()
Run your application and click the button ;)
Download the project:
nudger.rar (63,1 kB)