Dec 16, 2018, 09:46 PM

News: :: Capture your kids magical moment and create your Online Private Diary for your kids

Introduction to Splash Screen

Started by thiruvasagamani, May 21, 2009, 09:25 PM

previous topic - next topic
Go Down



This example demonstrates how to create a splash screen that is run on a thread separate from the main thread. This is done so as to allow the main thread to process loading and initialization while not having to explicitly update a progress animation. It is also advantageous to have the splash form on a separate thread so that it can process its own messages and thus receive paint messages when other applications interfere with its drawing. The main form will not be receiving these messages as it is theoretically busy in a load function and not processing messages.

The splash screen consists of a static background and an 8 cell animation that moves from left to right across the bottom of the image at a frame rate dependant, hard-coded rate. The animation was designed in this fashion to keep the code simple but still allow it to demonstrate how to optimize a draw routine by only updating areas of the background that were invalidated in the previous animation draw cycle. This optimization also helps identify the need for receiving paint messages while running on a separate thread because other applications may invalidate the form requiring it to redraw the entire background. On a single thread, these paint messages would not be received by the splash screen form until the main form had completed its processing " unless the code was peppered with Application.DoEvents() calls which is not an ideal or consistent solution.

The busy animation is updated at regular periodic intervals by a threaded timer (yes another thread). This allows it to give the processor back to the main form while it waits for its next draw cycle. Timing of the splash screen's total duration is also tracked using this timer.

The sample source code demonstrates the following concepts:

    * Loading and displaying a static background image
    * Loading and displaying an animated image
    * Starting two forms on separate threads
    * Invoking an EventHandler to shutdown a form on a separate thread
    * Creating a threaded timer
    * Loading embedded resources
    * Optimizing drawing by tracking invalid (dirty) rectangles

All of the splash screen interfaces are implemented in the form SplashForm so as to keep the interaction with the main form, appropriately title, MainForm as clean as possible. The code for this sample is available in Visual Basic and C# but in the interest of concision, this document refers only to the C# sample code.
Thiruvasakamani Karnan


this information gives me more useful to know about splash screen

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens | GinGly :: SMS Backup | Acumen :: Discussion Board | AshokPillar :: Hosting | CineBuzz :: Latest Cinema News | My Kids Diary :: Capture your kids magical moment
Copyright 2005 - 2017 :: IT Acumens :: All Rights Reserved.
ITAcumens Forum with 2 lakhs post running for 10 years - Powered by HostGator Dedicated Server