12 Replies - 5229 Views - Last Post: 30 August 2009 - 06:30 PM Rate Topic: -----

#1 devsfan1830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-August 09

Need help with a PNG splash screen

Posted 29 August 2009 - 11:52 PM

I'm trying to make a splash screen show up for a program i've written. I've search and searched but any help in this matter online seems to require a knowledge of coding to fill in the blanks. I would appreciated it if someone would take the time to spell out how to display this image: http://img93.imagesh...460/splashf.png

wherein that splash shows up, holds for 5 secs, fades, and opens the main program form. The PNG has built in transparency on its edges, they fade from solid to clear. I wish to be able to preserve this. Please include what "system." i need to include to make use of any code you write. I am running visual studio 2008 SP1 and using C#. Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Need help with a PNG splash screen

#2 debjit625  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 51
  • View blog
  • Posts: 446
  • Joined: 06-September 08

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 01:55 AM

Have you writen any code show that and tell which application is this is it a simple windows or wpf.
Was This Post Helpful? 0
  • +
  • -

#3 devsfan1830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-August 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 08:25 AM

Ok i used an online tutorial that involves threading, spawning a form with my image prior to running the main form. The issue is, my PNG has alpha channel transparency and using this method does not appear to use that. It relies on keying out the background color of the form, but any shades of it not matching dont go away. I am left with what you can see in the vid here. What I was hoping was possible, is to draw JUST the PNG itself on screen for a time then fading it away and allowing the main form to load. Basically, causing an artificial delay. Also, any examples of making the image fade in and out would be appreciated.

This isnt WPF, it is winForms.

Video: http://www.youtube.c...h?v=36hBFHE4GxQ

code in my splash form:

namespace CGArcade
{
	public partial class Splash : Form
	{
		public Splash()
		{
		 
			InitializeComponent();
			this.DoubleBuffered = true;
			//Bitmap b = new Bitmap(this.BackgroundImage);
		   // b.MakeTransparent(b.GetPixel(0, 0));
			//this.TransparencyKey = b.GetPixel(1,1);		
			//this.BackgroundImage = b;
		}

		
	}
}




Code in my main program window form
namespace NESLauncher2
{
	public partial class Form1 : Form
	{
		
		int page = 1;
		int mode = 1;

		public Form1()
		{
			InitializeComponent();
			this.DoubleBuffered = true;
			Thread th = new Thread(new ThreadStart(DoSplash));
			//th.ApartmentState = ApartmentState.STA;
			//th.IsBackground=true;
			th.Start();
			Thread.Sleep(3000);
			th.Abort();
			Thread.Sleep(1000);
			

		}

		private void DoSplash()
		{
		  
			CGArcade.Splash sp = new CGArcade.Splash();
			sp.ShowDialog();

		}



Was This Post Helpful? 0
  • +
  • -

#4 devsfan1830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-August 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 08:46 AM

Ok, I just started tinkering with making a WPF rather than a WinForm and its remarkable similar when working with the designer in VS 2008. I managed to get the splash screen effect i want to work as well. But it happens too fast.
Any way to slow this down, i noticed timers are not useable in WPF.

 public Window1()
		{		  
			
			InitializeComponent();
			SplashScreen splash = new SplashScreen("Splash.png");
			
			splash.Show(true);
			splash.Close(new TimeSpan(5000));
			
			
		}



This post has been edited by devsfan1830: 30 August 2009 - 08:47 AM

Was This Post Helpful? 0
  • +
  • -

#5 mager1794  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 133
  • Joined: 23-March 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 09:58 AM

I create a brand new form named 'splash' remove all borders set my image to its background then i show the form in the Load event for my starting form
i create a timer on the splash, to set after '5000' milliseconds to close the splash and after i show the splash in my form i use thread.Sleep(5000) that way it doesn't show up in the back while the splash is viewing.

i didn't give you the code cause i think you can do it yourself :)
good luck, its not hard just gotta be on the right track
Was This Post Helpful? 0
  • +
  • -

#6 devsfan1830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-August 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 10:25 AM

View Postmager1794, on 30 Aug, 2009 - 08:58 AM, said:

I create a brand new form named 'splash' remove all borders set my image to its background then i show the form in the Load event for my starting form
i create a timer on the splash, to set after '5000' milliseconds to close the splash and after i show the splash in my form i use thread.Sleep(5000) that way it doesn't show up in the back while the splash is viewing.

i didn't give you the code cause i think you can do it yourself :)
good luck, its not hard just gotta be on the right track

Thanks for the input, I'll give your delay method a try. I was tinkering with WPF but I don't think I'll use it since it'll be a pain to convert my forms design to a WPF format. If you could look at my video I used the method you described by opening a second form first with my image with all borders removed. By setting transparency key and the form background to FUSHIA I was able to make it go transparent. But the PNG has fading edges which causes a shade difference on the edges, leaving me with a pink rim. What I wanna do is to be able to spawn a transparent form, or just the png image itself, that perserves all the gradual transparencies of the PNG.
Was This Post Helpful? 0
  • +
  • -

#7 mager1794  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 133
  • Joined: 23-March 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 10:49 AM

okay transparent form is easy

			this.BackColor = System.Drawing.Color.LightSalmon
			this.TransparencyKey = System.Drawing.Color.LightSalmon;



or

on form load

			this.TransparencyKey = this.BackColor;


This post has been edited by mager1794: 30 August 2009 - 10:51 AM

Was This Post Helpful? 0
  • +
  • -

#8 devsfan1830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-August 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 11:04 AM

View Postmager1794, on 30 Aug, 2009 - 09:49 AM, said:

okay transparent form is easy

			this.BackColor = System.Drawing.Color.LightSalmon
			this.TransparencyKey = System.Drawing.Color.LightSalmon;


an
or

on form load

			this.TransparencyKey = this.BackColor;



That's what I am doing but because if the edge fade on the png, the form isn't totally masked out leaving solid edges on the splash. When I get home I will post photoshops of the effect I need. Sorry if it seems like I am fighting your suggestions, Im just not explaining this clearly.

This post has been edited by devsfan1830: 30 August 2009 - 11:07 AM

Was This Post Helpful? 0
  • +
  • -

#9 mager1794  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 133
  • Joined: 23-March 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 11:07 AM

is the image set as the background image?
Was This Post Helpful? 0
  • +
  • -

#10 devsfan1830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-August 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 12:27 PM

View Postmager1794, on 30 Aug, 2009 - 10:07 AM, said:

is the image set as the background image?


yes, specified via the properties pane (rather than manually coded)
Was This Post Helpful? 0
  • +
  • -

#11 devsfan1830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-August 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 01:24 PM

Okay, heres the screenies to show the settings i have for the splash form, the effect i WANT, and then the effect i actually get.


Settings: http://img22.imagesh.../settingsd.jpg/

Want: http://img443.images....us/i/want.jpg/ (This was made with Photoshop)

Get: http://img143.images....us/i/getw.jpg/
Was This Post Helpful? 0
  • +
  • -

#12 mager1794  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 133
  • Joined: 23-March 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 05:44 PM

what is your transparency key set to?
Was This Post Helpful? 0
  • +
  • -

#13 devsfan1830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-August 09

Re: Need help with a PNG splash screen

Posted 30 August 2009 - 06:30 PM

the same as my backcolor on my form. which is set to a color not in my image so that it doesnt cause any transparency bugs. and i got the delay thing to work, so all im needing help on now is the transparencys
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1