Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleMake a program's main form slide over its splash screen
DescriptionThis example shows how to make a program's main form slide over its splash screen in Visual Basic 6.
Keywordssplash screen, slide over
CategoriesControls, Software Engineering
 
Thanks to Frank Kelly. Visit his Web site.

When the program starts, it sets its Timer to 2 seconds. When the timer fires the first time, it resets its interval to 25 milliseconds. Each time the Timer event fires, the program moves the form a bit more to the right until it reaches its original position. At that point, the splash screen unloads itself.

 
Private Form1Left As Single

Private Sub Form_Load()
    ' Displays image to size of form regardless of
    ' screen resolution
    Image1.Move 0, 0, ScaleWidth, ScaleHeight
    Me.Show

    ' Start wiping in 2 seconds.
    Timer1.Interval = 2000
End Sub

Private Sub Timer1_Timer()
Static done_before As Boolean

Dim new_left As Single

    ' See if this is the first time.
    If Not done_before Then
        ' It's the first time. Start wiping the
        ' main form over the splash screen.
        done_before = True
        Timer1.Interval = 25
        Form1Left = Form1.Left
        Form1.Left = -Form1.Width
        Form1.Visible = True
    End If

    new_left = Form1.Left + 240
    If new_left > Form1Left Then
        new_left = Form1Left
        Unload Me
    End If

    Form1.Left = new_left
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated