Click here to Skip to main content
Click here to Skip to main content

Transparent Splash Screen

, 13 Jan 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
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:

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)

Share

About the Author

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

 

 
MCP, MCSD & MCAD

Comments and Discussions

 
QuestionBlack border on Alpha value PNG image Pinmemberjavageget21-Oct-11 22:14 
GeneralRe: Black border on Alpha value PNG image [modified] Pinmembermastersil8716-Jul-12 0:54 
GeneralMy vote of 3 PinmembersumeshMCA3-Jul-11 8:54 
GeneralNice Pinmembervbfengshui9-Feb-11 9:54 
GeneralCheers Pinmembermatt335-Aug-10 3:08 
GeneralThis sample does not show how to create a splash screen PinmemberAliasGoesHere19-Nov-07 4:44 
AnswerThe sample given is for both a splash screen and an about box. PinmemberDameonBlack19-Nov-07 12:57 
GeneralKISS PinmemberMarco Ensing31-May-07 15:17 
GeneralProblem with the VB 2005 Pinmembereclisia24-Apr-07 23:05 
Hello, I'm using your code. Thank for it. But I meet a problem. I use Visual Basic 2005 Express, and when I want to change your picture by one of mine, I meet an exception error concerning this part of the code:
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))
 
The error message is:
 
L'exception System.TypeInitializationException n'a pas été gérée
Message="Une exception a été levée par l'initialiseur de type pour 'PNG.IMA'."
Source="PNG"
TypeName="PNG.IMA"
StackTrace:
à PNG.SplashScreen.OnPaintBackground(PaintEventArgs pevent) dans C:\Documents and Settings\Flo\Bureau\PNG_-_Labels\SplashScreen.vb:ligne 117
à System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
à System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
à System.Windows.Forms.Control.WndProc(Message& m)
à System.Windows.Forms.ScrollableControl.WndProc(Message& m)
à System.Windows.Forms.ContainerControl.WndProc(Message& m)
à System.Windows.Forms.Form.WndProc(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
à System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
à System.Windows.Forms.Control.SetVisibleCore(Boolean value)
à System.Windows.Forms.Form.SetVisibleCore(Boolean value)
à System.Windows.Forms.Control.set_Visible(Boolean value)
à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
à System.Windows.Forms.Application.Run(Form mainForm)
à PNG.SplashScreen.Main() dans C:\Documents and Settings\Flo\Bureau\PNG_-_Labels\SplashScreen.vb:ligne 7
à System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()

 

So, I can't see my error. Please, help me. thank you.
GeneralRe: Problem with the VB 2005 Pinmembereclisia25-Apr-07 0:19 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 13 Jan 2006
Article Copyright 2004 by DameonBlack
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid