Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[VB.NET]Shaking Form[TUT]

VB.NET Shaking Form Tutorial

Made by H3x0S





1.Make New Project in VB.NET
2.Place a button on the form.
3.Double click a button.
4.Type in this code:


Dim a As Integer
' <- Declaring integer "a"
While a < 10 ' <- Starting a "while loop"
Me.Location = New Point(Me.Location.X + 20, Me.Location.Y) ' <- Setting our form's X position to 20 pixels to right from it's current position.
System.Threading.Thread.Sleep(50) ' <- Telling a program to sleep for 50 miliseconds before continuing
Me.Location = New Point(Me.Location.X - 20, Me.Location.Y) ' <- Setting our form's X position to 20 pixels to left from it's current position.
System.Threading.Thread.Sleep(50) '<- Telling a program to sleep for 50 miliseconds before continuing
a += 1 ' <- Increasing integer "a" by 1 after each loop
End While ' <- Ending a while loop

If you want to change shanking duration, edit this line of code(replace 10 with some other number):
Code
While a < 10


If you want to change interval between shakes, edit this lines(replace number 50 with some other number):
Code
System.Threading.Thread.Sleep(50)
Great Thread, Gonna Try it
Thanks For Posting it =)
NP man!
I will make more tutorials soon!
going to try this soon as well...just got back from a week vacation!
Instead of using While and a += 1, use For.

Code
For a = 0 to 10
'code
Next
Could you give an example where this would be useful?
Thanks for the tut
--
(Feb 17, 2010 05:34 PM)Psycho Wrote:  Could you give an example where this would be useful?

well if you put this on a mouseover on a program you didnt want some one to close lol...it would just take off if you adjusted the pixels and made it move further

just an idea i had 4 it 🤝
It works very good, good source code.
(Feb 28, 2010 04:48 PM)TheBlackMarket Wrote:  It works very good, good source code.

Thank you!
nice feature to add to TOPMOST function.
Code
For a = 5 To 35 'How much it shakes, change to see what I mean.
For b = 0 To 15 'How long it takes to complete the shakes.
Me.Location = New Point(Me.Location.X, Me.Location.Y + a)
Me.Location = New Point(Me.Location.X + a, Me.Location.Y)
Me.Location = New Point(Me.Location.X, Me.Location.Y - a)
Me.Location = New Point(Me.Location.X - a, Me.Location.Y)
Next
Next

For a = 1 To 5 (just a little shakey)
For a = 25 To 35 (will move ALOT)
For a = 150 To 200 (crazy shakes aka Michael J fox)
For a = 1 To 45 (starts off slow but gets pretty crazy)


Just made this, didn't do a lot of testing but i know it works good.

You might may want to add an interval between each movement like this:-
System.Threading.Thread.Sleep(5)
If you do you will need to keep the ranges between the two numbers pretty low or it will shake for a long time.
Oh, and probably change the line 'b = 0 to 15' to just 'b = 0 to 2'
+ Rep duckroll, sweet as.
Nice! Very N00b proof!
nice tut simple and nice to play with times and places of the form.
could be used in anoying forms for web.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by Ðr1psNov 9, 2015 03:56 PM 19 416 Nov 9, 2015 03:56 PM
Last Post: Ðr1ps
[.NET] by WildElephantApr 21, 2015 10:48 AM 7 177 Apr 21, 2015 10:48 AM
Last Post: nuk
[C#] by ShedletskyJan 4, 2015 04:26 PM 6 229 Jan 4, 2015 04:26 PM
Last Post: Shedletsky