Home All Groups Group Topic Archive Search About
Author
17 Feb 2006 2:06 PM
pmclinn
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?

Author
17 Feb 2006 2:25 PM
Peter Proost
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)

Show quoteHide quote
"pmclinn" <pmcl***@gmail.com> schreef in bericht
news:1140185182.354806.286310@g14g2000cwa.googlegroups.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?
>
Author
17 Feb 2006 2:29 PM
Herfried K. Wagner [MVP]
"pmclinn" <pmcl***@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/>