Click here to Skip to main content
15,885,537 members
Articles / Programming Languages / Visual Basic
Article

Transparent Splash Screen

Rate me:
Please Sign up or sign in to vote.
4.86/5 (26 votes)
13 Jan 2006CPOL 350.8K   17.3K   134   71
Creating a transparent Splash Screen - like the one used by Adobe.

Introduction

Anyone interested in making a transparent splash screen? Like the one used by Adobe? This one was done by rendering PNG files that use Alpha. Inluded in the download, you will find a full example using Visual Basic .NET 2003. I'm using embedded resources for the image... I have installed and run this project correctly on Windows 98, XP, 2000.

Here are the two most important functions to use inside your splash screen form:

VB
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    ' Do nothing here!
End Sub

Protected Overrides Sub OnPaintBackground(
    ByVal pevent As System.Windows.Forms.PaintEventArgs)
    Dim gfx As dra.Graphics = pevent.Graphics
    gfx.DrawImage(IMA.imaSplashScreen, New dra.Rectangle(0, 0, Me.Width, Me.Height))
End Sub

P.S. This is a very easy way to accomplish this, without using API calls and such messy stuff like that. You should be able to make splash screens and About boxes like the one I have used in my project.

WaterScript.jpg

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
Just another programmer trying to figure it all out. Big Grin | :-D





MCP, MCSD & MCAD

Comments and Discussions

 
GeneralRe: Black Background Pin
Legandir17-Jan-06 6:26
Legandir17-Jan-06 6:26 
AnswerRe: Black Background Pin
cycnus24-May-06 16:41
cycnus24-May-06 16:41 
AnswerRe: Black Background Pin
ehoang31-Jul-07 9:10
ehoang31-Jul-07 9:10 
GeneralAbout the actuall program Pin
per-i18-Jun-05 2:03
per-i18-Jun-05 2:03 
GeneralRe: About the actuall program Pin
DameonBlack18-Jun-05 10:56
DameonBlack18-Jun-05 10:56 
GeneralRe: About the actuall program Pin
DameonBlack18-Jun-05 11:03
DameonBlack18-Jun-05 11:03 
GeneralRe: About the actuall program Pin
per-i20-Jun-05 11:00
per-i20-Jun-05 11:00 
GeneralTransparency and fading form Pin
daniel_l24-Apr-05 22:16
daniel_l24-Apr-05 22:16 
Hi I used your example to create my own splash screen. It worked great. Thank you.

However I wanted to add a fade effect to my splash screen and used the Opacity property and a timer to fade in the splash screen. But the image is not transparent when fading, the color used as transparent color in photoshop shows where it should be transparent.

Is this by design or is it something I have done wrong? Can it be accomplished any other way?

My code for fading in looks something like this:

Private Sub fadeIn() 'called from Private Sub Initialize()
tmeFade = New System.Windows.Forms.Timer
Me.Opacity = m_dblMinOp
m_dblFadeStep = (m_maxOp - m_minOp) / (m_intFadeTime / m_intFadeInterval)
m_bolFadingIn = True

Me.BringToFront()
Debug.WriteLine(m_dblFadeStep)
With tmeFade
.Interval = m_intFadeInterval
.Start()
End With
End Sub

Private Sub tmeFade_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmeFade.Tick
Dim dblOp As Double
Me.BringToFront()
If m_bolFadingIn Then
dblOp = Me.Opacity + m_dblFadeStep
If dblOp > 1 Then
dblOp = 1
End If
Me.Opacity = dblOp

Debug.WriteLine(Me.Opacity)
If (dblOp >= m_maxOp) Then
tmeFade.Stop()
End If
Else 'fading out
dblOp = Me.Opacity - m_dblFadeStep
If (dblOp <= 0) Then
tmeFade.Stop()
Me.Close()
Else
Me.Opacity = dblOp
End If
End If
End Sub
GeneralRe: Transparency and fading form Pin
Anonymous25-Apr-05 3:22
Anonymous25-Apr-05 3:22 
QuestionHow do i do this using c? Pin
Kalamatee2-Oct-04 6:24
Kalamatee2-Oct-04 6:24 
AnswerRe: How do i do this using c? Pin
DameonBlack2-Oct-04 11:53
DameonBlack2-Oct-04 11:53 
GeneralRe: How do i do this using c? Pin
unabatedshagie11-Jan-06 9:36
unabatedshagie11-Jan-06 9:36 
GeneralRe: How do i do this using c#? Pin
DameonBlack12-Jan-06 3:55
DameonBlack12-Jan-06 3:55 
GeneralProblem!... Pin
Murat YILDIZ30-Aug-04 4:07
Murat YILDIZ30-Aug-04 4:07 
GeneralRe: Problem!... Pin
Anonymous30-Aug-04 5:18
Anonymous30-Aug-04 5:18 
GeneralRe: Problem!... Pin
webbc16-Jan-06 7:10
webbc16-Jan-06 7:10 
QuestionRe: Problem!... Pin
editaliasrl19-Jan-06 1:49
editaliasrl19-Jan-06 1:49 
AnswerRe: Problem!... Pin
fadee22-Mar-07 22:27
fadee22-Mar-07 22:27 
QuestionWhat program created the graphic? Pin
mistert00630-Jul-04 8:00
mistert00630-Jul-04 8:00 
AnswerRe: What program created the graphic? Pin
DameonBlack30-Jul-04 8:10
DameonBlack30-Jul-04 8:10 
GeneralRe: What program created the graphic? Pin
Tom Dziedzic24-Aug-04 12:32
Tom Dziedzic24-Aug-04 12:32 
QuestionHow to create the resource file? Pin
starlogic15-Jun-04 10:25
starlogic15-Jun-04 10:25 
AnswerRe: How to create the resource file? Pin
DameonBlack30-Jul-04 8:21
DameonBlack30-Jul-04 8:21 
QuestionDoes it run on windows systems without having the .NET runtime ? Pin
axxex29-Apr-04 1:53
sussaxxex29-Apr-04 1:53 
AnswerRe: Does it run on windows systems without having the .NET runtime ? Pin
DameonBlack29-Apr-04 8:09
DameonBlack29-Apr-04 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.