
26_053416 ch19.qxd 1/2/07 6:36 PM Page 495 Splash Screens The first thing a user sees of an application is its splash screen. As the adage says, “You only get one chance to make a first impression,” so it’s important that your splash screen represent your application appropriately. Though the user only gets one first impression of your application, the splash screen appears every time the application starts, so it’s important that it has a positive impact each time the user sees it. A typical splash screen displays some basic information about the application such as its name, version number, and copyright information. Splash screens often provide contact information so that users can get technical support if necessary. In addition to giving the user a little information, a splash screen gives the user something to look at while the application loads. At this point, the application might look for all sorts of resources such as databases, files, special devices, network connections, remotely mounted drives, Web Services, and so forth. It can connect to databases and open files, parse XML data, and otherwise get ready for business. If a program takes several seconds to do all this, then a splash screen shows the user that something is happening. If it includes a progress bar or status animation, it can let the user know that the program is working and has not become stuck. The application can also perform security checks while the splash screen is visible. It can try to open password-protected databases, check the user’s credentials, and see if it can connect to the network through the user’s firewall. In some applications, I have included user name and password text boxes on the splash screen so that the user can use it to log in. The splash screen’s code then checked a password database to verify that the user name and password were correct, and to see what kind of user this is (clerk, supervisor, manager, and so forth). The rest of the application used that information to configure itself, displaying or hiding menus and buttons as appropriate. A well-crafted splash screen shows the users that you pay attention to details and makes an appli- cation look more professional. I usually build a splash screen for a new application as soon as development starts so that customers viewing prototypes can see it. In one application for the 26_053416 ch19.qxd 1/2/07 6:36 PM Page 496 Part IV: Specific Techniques State of Minnesota, I made a splash screen in the shape of the state’s map. After the initial demonstra- tion, the first question they asked was, “How did you make that cool splash screen?” (The second question they asked was, “How long did it take?” They liked the splash screen but didn’t want to waste money on frills. As you’ll see in this chapter, making a shaped splash screen only takes a few minutes.) This chapter explains how to build and use splash screens in Visual Basic. It tells how to add interesting and unusual features to a splash screen, such as a shaped form, rotated text, and text filled with a color gradient or pattern. Adding all of these features to every form in a project would probably make the application appear cluttered and distracting, but in a splash screen, they can make an otherwise utilitar- ian form more interesting. Determining Splash Screen Contents Figure 19-1 shows the splash screen displayed by the ShapedSplashScreen example application. (You can download this example at www.vb-helper.com/one_on_one.htm.) The form is shaped to fit an image on the left and has rounded corners. It displays the application’s title eJack in outlined text that is filled with a color gradient shading from red to yellow to green (it looks much better on the screen than in this book). It displays the program’s version, serial number, and copyright information. It also displays a progress bar to show the user how far the application has proceeded in loading its data. Figure 19-1: The ShapedSplashScreen program displays this splash screen when it starts. The image on the left in Figure 19-1 was even generated by Visual Basic, specifically Visual Basic 6 code from my book, Visual Basic Graphics Programming: Hands-On Applications and Advanced Color Development, Second Edition (Indianapolis: Wiley, 1999). A program’s About dialog should also display the same information. It should display the program’s name, version, serial number, and copyright statement. Because the About dialog contains the same information as the splash screen, it makes sense to use the same form for both. Figure 19-2 shows the ShapedSplashScreen program displaying its About dialog. It is similar to the splash screen except that it doesn’t display a progress bar. It also displays a rotated link to the support Web site www.vb-helper.com and an OK button so the user can close it. 496 26_053416 ch19.qxd 1/2/07 6:36 PM Page 497 Chapter 19: Splash Screens Figure 19-2: The About dialog displays much of the same information as the splash screen. A splash screen should not display system information such as memory usage or disk space. To manage system resources, the user should use the operating system tools, not your application. When a user needs help with an application, the technical support people usually need to know the pro- gram’s serial number. These numbers are often quite long (my Visual Basic serial number has 20 digits plus embedded dashes), so, to make entering the serial number in an email easier, the About dialog dis- plays it in a read-only text box. That allows the user to select the serial number, press Ctrl+C to copy it to the clipboard, and then press Ctrl+V to paste it into the email. Many splash screens and About dialogs also contain hidden surprises, often called Easter Eggs. If you hover the mouse over a small area on the dot in the title’s exclamation point, the mouse cursor changes to a crosshair. If you click that spot, the hidden screen shown in Figure 19-3 appears. Often, this kind of hidden screen displays extra non-critical information such as the names of the developers who worked on the application. Figure 19-3: This surprise screen displays animations of an atom and caffeine molecule. Some hidden screens are extremely elaborate. Some play music or make the developers’ names appear in an amusing animation. I’ve even seen some that included complicated games that the user can play. Whereas splash screens provide important information and feedback while the application is loading, hidden screens are definitely optional. They’re usually fun and easy to build, however, so developers can add them in a spare moment without much wasted effort (complicated games notwithstanding). 497 26_053416 ch19.qxd 1/2/07 6:36 PM Page 498 Part IV: Specific Techniques Displaying Splash Screens Visual Basic provides a way to automatically display a splash screen, although it’s a little awkward and not very well-documented. First, build the form you want to use as a splash screen. Then open Solution Explorer and double-click the My Project item. On the Application tab, scroll to the bottom and select the form in the “Splash screen” drop-down, as shown in Figure 19-4. Figure 19-4: Select the splash screen’s form from the drop-down list. At this point, Visual Basic will automatically display the splash screen when the application starts. It dis- plays the form until the program’s main form has finished its startup sequence, or until a certain mini- mum amount of time has passed, whichever comes second. Unfortunately, changing the minimum amount of time or adding data loading code requires some extra work on your part. To do either of these tasks, open Solution Explorer and double-click the My Project entry. On the Application tab, click the View Application Events button at the bottom, as shown in Figure 19-4. To change the minimum amount of time the splash screen is displayed, add the following code to the MyApplication class to override the class’s OnInitialize method. This code sets the application’s MinimumSplashScreenDisplayTime property to 5 seconds (5,000 milliseconds) rather than its default value of 3 seconds. It then calls the base class’s OnInitialize method so that the application can resume its startup procedure as normal. ‘ Override OnInitialize to set the splash screen’s minimum display time. Protected Overrides Function OnInitialize(ByVal commandLineArgs As _ 498 26_053416 ch19.qxd 1/2/07 6:36 PM Page 499 Chapter 19: Splash Screens System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean ‘ Display the splash screen for at least 3 seconds. Me.MinimumSplashScreenDisplayTime = 3000 ‘ Continue initialization as usual. Return MyBase.OnInitialize(commandLineArgs) End Function The minimum amount of time that a splash screen should be visible is a matter of preference, but 2 or 3 seconds seems to work best. If the form vanishes after less than 2 seconds, the user doesn’t really have a chance to see it. If the form sticks around for more than 5 seconds, it violates the “5-second rule” that says an interactive application should respond within 5 seconds whenever possible. Visual Basic displays the splash screen for a minimum amount of time, or until the main form finishes its startup sequence. To get the most benefit from the splash screen, you should make the application load data, connect to databases, use Web Services to check for updates, and perform other lengthy startup actions during this time.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages17 Page
-
File Size-