splash

Wormlett

Member
Joined
Jun 25, 2004
Messages
9
Programming Experience
Beginner
Hello, i have a splash page in my program. that has some simple animation. pictures move and explode to the toolbar. but I was wondering how to make it so that if someone presses Enter, then it will skip to the end of the animation?

This is what is going on with it right now....should i just add an if statement? and how do i do that to skip it to the end?


Private Sub Timer1_Tick(ByVal Sender As Object, ByVal e As EventArgs) Handles Timer1.Tick

Dim xDestination As Integer = Me.tbRightSide.Left
Dim yDestination As Integer = 0

bTargetReached = False

'The Explosion

'The Shrink-n-Move
Select Case iAnimatingImageIndex
Case Is = 0
yDestination = Me.tbRightSide.Top
Case Is = 1
yDestination = Me.tbRightSide.Top + 50
Case Is = 2
yDestination = Me.tbRightSide.Top + 100
Case Is = 3
yDestination = Me.tbRightSide.Top + 200
End Select
If Me.PictureBox1.Height > 50 Then Me.PictureBox1.Height = Me.PictureBox1.Height - 3
If Me.PictureBox1.Width > 50 Then Me.PictureBox1.Width = Me.PictureBox1.Width - 3
If Me.PictureBox1.Top >= yDestination Then Me.PictureBox1.Top = Me.PictureBox1.Top - 2
If Me.PictureBox1.Left <= xDestination Then Me.PictureBox1.Left = Me.PictureBox1.Left + 8
If Me.PictureBox1.Top <= yDestination And Me.PictureBox1.Left >= xDestination Then
bTargetReached = True
End If


'Reset and move to next image
If bTargetReached = True Then

Me.Timer1.Stop()

Me.PictureBox1.Height = 250
Me.PictureBox1.Width = 250
Me.PictureBox1.Top = 150
Me.PictureBox1.Left = 270

Select Case iAnimatingImageIndex
Case Is = 0
iAnimatingImageIndex = 1
bTargetReached = True

'Show TB Button
Dim toolBarButton0 As New ToolBarButton
Me.tbRightSide.ImageList = Me.ilRightTBImages
toolBarButton0.ImageIndex = 0
' Add the new toolbar button to the toolbar.
Me.tbRightSide.Buttons.Add(toolBarButton0)
toolBarButton0.ToolTipText = "Calculate Monthly Payments and Closing Costs"


Case Is = 1
iAnimatingImageIndex = 2
bTargetReached = True

Dim toolBarButton1 As New ToolBarButton
Me.tbRightSide.ImageList = Me.ilRightTBImages
toolBarButton1.ImageIndex = 1
' Add the new toolbar button to the toolbar.
Me.tbRightSide.Buttons.Add(toolBarButton1)
toolBarButton1.ToolTipText = "The 1003 Form"

Case Is = 2
iAnimatingImageIndex = 3
bTargetReached = True

Dim toolBarButton2 As New ToolBarButton
Me.tbRightSide.ImageList = Me.ilRightTBImages
toolBarButton2.ImageIndex = 2
' Add the new toolbar button to the toolbar.
Me.tbRightSide.Buttons.Add(toolBarButton2)
toolBarButton2.ToolTipText = "The Address Book"

Case Else
Dim toolBarButton3 As New ToolBarButton
Me.tbRightSide.ImageList = Me.ilRightTBImages
toolBarButton3.ImageIndex = 3
' Add the new toolbar button to the toolbar.
Me.tbRightSide.Buttons.Add(toolBarButton3)
toolBarButton3.ToolTipText = "All the forms, disclosures and reports"

iAnimatingImageIndex = 10
Me.Timer1.Stop()
Me.PictureBox1.Visible = False
Me.Timer1.Enabled = False
Me.Timer1.Stop()

'Flag so the Paint event of the main form wont call us anymore
bAnimationComplete = True
Me.tbRightSide.ShowToolTips = True
lblPicture1Label.Visible = False
End Select

End If

End Sub
 
In the splash form's KeyDown event, disable the Timer and set all the flags that you set when the animation is complete:

VB.NET:
Private Sub frm_KeyDown(ByVal sender As Object, _
  ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    If e.KeyCode = Keys.Enter Then
        Me.PictureBox1.Visible = False
        Me.Timer1.Enabled = False
        bAnimationComplete = True
        Me.tbRightSide.ShowToolTips = True
        lblPicture1Label.Visible = False
    End If
End Sub
 
Put 'Application.DoEvents' in your timer code loop (maybe in several different places).

This will allow the app to respond to the keyDown event for the ENTER key.
 
still get nothing happening...i even added it so it should pop up a message box just as a check, but that doesnt even pop up...
 

Latest posts

Back
Top