By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,579 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,579 IT Pros & Developers. It's quick & easy.

Form Shake

P: n/a
I have a splash screen that boots with music in the background. I want
the splash screen to look like it is shaking, or is being shaked. What
is the best way to do this?

Feb 17 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi put a button on a form

and then paste this code, I hope this is enough shaking for you, probably
there are some nicer solutions but this should give you an idea

Hope this helps

Greetz Peter
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
shakeMe()
End Sub

Private Sub shakeMe()
Dim myLoc As Point, myLocDef As Point
myLocDef = Me.Location
myLoc = Me.Location
For i As Integer = 0 To 100
For x As Integer = 0 To 4
Select Case x
Case 0
myLoc.X = myLocDef.X + 10
Case 1
myLoc.X = myLocDef.X - 10
Case 2
myLoc.Y = myLocDef.Y - 10
Case 3
myLoc.Y = myLocDef.Y + 10
Case 4
myLoc = myLocDef
End Select
Me.Location = myLoc
Me.Refresh()
Next
Next
Me.Location = myLocDef
Me.Refresh()
End Sub

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"pmclinn" <pm*****@gmail.com> schreef in bericht
news:11**********************@g14g2000cwa.googlegr oups.com...
I have a splash screen that boots with music in the background. I want
the splash screen to look like it is shaking, or is being shaked. What
is the best way to do this?

Feb 17 '06 #2

P: n/a
"pmclinn" <pm*****@gmail.com> schrieb:
I have a splash screen that boots with music in the background. I want
the splash screen to look like it is shaking, or is being shaked. What
is the best way to do this?


Place a timer on the form and move the form within its 'Tick' event handler
('Form.{Location, Left, Top}').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Feb 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.