Hack Forums
[.NET] [VB.NET]Shaking Form[TUT] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [VB.NET]Shaking Form[TUT] (/showthread.php?tid=236447)

Pages: Pages 1 2


[VB.NET]Shaking Form[TUT] - H3x0S - Jan 17, 2010

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)



* - The End Gamer - Jan 17, 2010

Great Thread, Gonna Try it
Thanks For Posting it =)


* - H3x0S - Jan 17, 2010

NP man!
I will make more tutorials soon!


* - The_KGB - Jan 17, 2010

going to try this soon as well...just got back from a week vacation!


* - Vice - Jan 17, 2010

Instead of using While and a += 1, use For.

Code
For a = 0 to 10
'code
Next



* - Psycho - Feb 17, 2010

Could you give an example where this would be useful?


* - 0dayleet - Feb 17, 2010

Thanks for the tut


* - Dark Molecule - Feb 17, 2010

(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 🤝


* - TheBlackMarket - Feb 28, 2010

It works very good, good source code.


* - H3x0S - Feb 28, 2010

(Feb 28, 2010 04:48 PM)TheBlackMarket Wrote:  It works very good, good source code.

Thank you!


* - g0dl1ke2012 - Mar 1, 2010

nice feature to add to TOPMOST function.


* - MisterDeepRot - Mar 1, 2010

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'



* - g0dl1ke2012 - Mar 2, 2010

+ Rep duckroll, sweet as.


* - HaXZX0r - Mar 2, 2010

Nice! Very N00b proof!


* - xartermate - Aug 10, 2010

nice tut simple and nice to play with times and places of the form.
could be used in anoying forms for web.