Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '------------------------------------------------------------------------------------------
- ' Notice of My Copyright and Intellectual Property Rights
- '
- ' Any intellectual property contained within the program by Joseph L. Bolen remains the
- ' intellectual property of the Joseph L. Bolen. This means that no person may distribute,
- ' publish or provide such intellectual property to any other person or entity for any
- ' reason, commercial or otherwise, without the express written permission of Joseph L. Bolen.
- '
- ' Copyright © 2016. All rights reserved.
- ' All trademarks remain the property of their respective owners.
- '-------------------------------------------------------------------------------------------
- ' Program Name: Splash Screen Demo
- '
- ' Author: Joseph L. Bolen
- ' Date Created: 07 DEC 2016
- '
- ' Description: Demonstrate how to use Progress Bar in a "artificially" controlled
- ' Splash Screen display.
- '
- ' Documentation is at:
- ' App's screen image is at: http://imgur.com/W1MJO4t
- ' App's Visual Basic .NET code is at: http://pastebin.com/k6q5yaLt
- ' Video tutorial at YouTube: http://www.youtube.com/user/bolenpresents
- '
- ' NOTE: For this project to work correctly, on the Application Tab of the
- ' project, set the following:
- ' Startup form : SplashSceeenForm
- ' Shutdown mode: When last form closes
- ' Splash screen: (None)
- '
- ' For true Splash Screen processing, see:
- ' "My.Application.MinimumSplashScreenDisplayTime Property"
- ' https://msdn.microsoft.com/en-us/library/ms234874(v=vs.90).aspx
- '
- '-------------------------------------------------------------------------------------------
- Public Class SplashScreenForm
- Private WithEvents MyTimer As New Timer
- Const SPLASH_SCREEN_DISPLAY_TIME As Integer = 5 ' Number of seconds to display screen
- Const FRAMES_PER_SECOND As Integer = 30 ' Frames per second
- Private Sub SplashScreenForm_Load(sender As Object, e As EventArgs) _
- Handles MyBase.Load
- With MyProgressBar
- .Maximum = SPLASH_SCREEN_DISPLAY_TIME * FRAMES_PER_SECOND
- .Step = 1
- .Value = 1
- .Style = ProgressBarStyle.Continuous
- End With
- StatusLabel.Text = "Loading ..."
- MyTimer.Interval = 1000 \ FRAMES_PER_SECOND
- MyTimer.Start()
- End Sub
- Private Sub MyTimer_Tick(sender As Object, e As EventArgs) _
- Handles MyTimer.Tick
- MyProgressBar.PerformStep()
- StatusLabel.Text = String.Format("{0:N0} %", (MyProgressBar.Value / MyProgressBar.Maximum * 100))
- If MyProgressBar.Value >= MyProgressBar.Maximum Then
- MyTimer.Stop()
- StatusLabel.Text = "Ready"
- ' Transfer control to MainForm
- Dim frm As New MainForm
- frm.Show()
- Me.Close()
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment