|
I was wondering if there's anything wrong if I change the code according to my own source.
Because I calling the image directly from the resource. This is example..
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
End Sub
Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
Dim gfx As Graphics = pevent.Graphics
gfx.DrawImage(My.Resources.splash1, New Drawing.Rectangle(0, 0, Me.Width, Me.Height))
End Sub
According to your example; you would place other stuff such as Assembly stuff and new resource declaration.
|
|
|
|
|
Maybe you got the same error like me, my fault was "Form.DoubleBuffered = true". You have to disable that. Another possible fault is doing some manual stuff with the graphics object, like Clear(Color.Transparent) this also results in a black backround from the form.
-- modified 16-Jul-12 6:03am.
|
|
|
|
|
|
You got my 5.
Only trick I noticed is that you have to turn off all the min/max/control boxes on the target form, AND be sure to set the border style to none.
Works a treat though
Thanks!
vbfengshui
|
|
|
|
|
Did the job perfectly
|
|
|
|
|
It shows how to make a transparent "About" box.
If you are looking for answers to help you meet the challenges of a splash screen, you won't find them in this article.
|
|
|
|
|
This code was used to create a splash screen and an About box.
The example here comes from a real enterprise level application.
The primary point of the example is to show how to display a transparent window which can be used for both a splash screen and an about box.
Please explain what problems you are having.
Why are you unable to use this for a splash screen?
Thanks,
Dameon Black
|
|
|
|
|
Much better than all other examples I've seen. Just Keep It Simple Stupid.
xxx
|
|
|
|
|
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.
|
|
|
|
|
I've find my problem
In fact, when you add your own picture to the project we need to change the default property
So you have to right-clic on the picture (in the solution explorer)
then "property"
Then you have to change the value of "generation's action" into "incorporated ressources"
after that, the error I've get will not appears.
Have fun!
|
|
|
|
|
Hello,
I love your Transparent Splash Screen.
I am looking for a Splash Screen for C++.
In fact, I cannot even find ANY code to load a .PNG transparent file for C++ that actually works and does not carry alot of baggage.
I think the best implementation would be to use CImage or GDI+, plus noone seems to be creating a splash screen using either. Everyone uses masked bitmaps and the like.
Does anyone know of anything to accomplish this is C++?
Any help would be greatly appreciated.
Thanks,
Tony
|
|
|
|
|
By using managed code in C++ you could do this using almost the same code as my examples.
Using raw c++ it would take me a long time to figure that one out.
Thanks,
Dameon Black
|
|
|
|
|
Hi,
I notice that if any part of the screen behind the splash moves then the form doesn't repaint the png.
The bg is basically stuck with what ever was there when the splash draws the first time.
Is this something only on xp?
Any ideas would be very much appreciated.
Thanks,
Timur
|
|
|
|
|
Hi,
This is standard behavior for this splash screen.
Because it's a splash screen it's not very often that things move behind the form.
Thanks,
Dameon Black
|
|
|
|
|
Okay, but what if I want to do it? I mean I want to take care of things if something move behind the form?
Any help?
I can buy you a donut
Rgds,
-------------------
Therez No Place like ... 127.0.0.1
|
|
|
|
|
Have you tried triggering the OnPaint by a timer (you can use the timer_tick event and set it to 50ms).
If perform someUIobject.Invalidate it will cause redrawing.
I am not sure how it would affect the other features though.
If you have any success - pls tell me also.
|
|
|
|
|
The transparency is a particularly cool addition to the standard splash screen - thanks!
However, how do you deal with the initial delay when loading the .NET framework? I've found that on older machines, it can take between 10 - 20 seconds for the .NET framework to be loaded after a reboot. During this time, none of my .NET code will run.
I call my splashscreen code as the very first line of my .NET app. However, this isn't executed until the .NET framework is loaded, meaning that there is still a 10 - 20 second delay before my app can show its splashscreen.
Do you know how to get the splashscreen to display before the .NET framework has loaded?
Thanks
-- modified at 11:43 Wednesday 21st June, 2006
|
|
|
|
|
After searching with no luck, I created a Win32 splash screen component for .NET applications that shows a customised splash screen instantly, and then starts your .NET application (and hence the framework) on a background thread.
Works pretty well, and also allows you to pass messages between the splash screen and your .NET app, so you can use it while you initiliase DB connections etc.
Check it out at http://www.quicksplash.net
-- modified at 4:11 Monday 2nd October, 2006
|
|
|
|
|
You *found* a splash screen component? How about you *created* a splash screen component and you're abusing the Code Project feedback system by plugging it on every article that relates to splash screens?
I haven't tried your component so I can't talk to its quality; I'm sure it's very good. But in the interests of full dislosure why don't you just say what you have and offer it without insulting peoples intelligence?
|
|
|
|
|
NVoli,
You're right; that was wrong and unethical of me.
I apologise; and have updated my original message to say that I created the component.
|
|
|
|
|
Hahahaaa!!!!
I was just about to post the URL to your splash screen but decided I would look here to find something better.
I do appreciate the links to two very good articles to MSDN on improving startup time.
My applications loads on startup and runs in the system tray, I don't have the startup issue, what I do have is the initial form is heaving and takes time to load, with that being said; what do you think about putting this on a different thread and then killing it when the form loads.
Thanx!
~Mann.
|
|
|
|
|
Sounds like a good idea - give it a try and let us know how it worked for you.
Some sample code would be great!
|
|
|
|
|
Hello ,,,
I liked this subject so much
but I don't know where I can get this program (WaterScript v2)
Can you lead me ?
Thank you
|
|
|
|
|
Hi
Water Script is an application I wrote for a company which sells water park equipment.
It's a sales tool, park control system, and inventory management program.
Sales - Uses it to display to customers what is possible in a 3D environment.
Inventory - The finished park layout is sent back to WaterOdyssey which is used to determine what parts need to be ordered for the customer.
Customers - Use it to setup how the park runs, what turns on when and how much. Also, it has multiple scenarios for running differently throughout the year.
Here are the web sites:
www.waterodyssey.com
www.fountainpeople.com
Thanks,
David Sisson
|
|
|
|
|
Hi,
Thanks for your tutorial, but there is a problem with VS2005 : When the window behind changing, the splash screen isn't updated.
Have you got a solution ?
Tks.
|
|
|
|