Click here to Skip to main content
16,004,778 members
Home / Discussions / C#
   

C#

 
GeneralTAPI UNIMODEM CALL DISCONNECT NOTIFICATION PROBLEM Pin
mamirbalouch27-Mar-08 22:49
mamirbalouch27-Mar-08 22:49 
QuestionJavascript in C# Pin
jonhbt27-Mar-08 22:10
jonhbt27-Mar-08 22:10 
GeneralRe: Javascript in C# Pin
pmarfleet27-Mar-08 22:52
pmarfleet27-Mar-08 22:52 
QuestionRe: Javascript in C# Pin
jonhbt28-Mar-08 0:50
jonhbt28-Mar-08 0:50 
GeneralRe: Javascript in C# Pin
Guffa28-Mar-08 1:25
Guffa28-Mar-08 1:25 
GeneralRe: Javascript in C# Pin
alhgamy3-Apr-08 6:36
alhgamy3-Apr-08 6:36 
AnswerRe: Javascript in C# Pin
Rritesh Ravlani1-May-08 21:13
Rritesh Ravlani1-May-08 21:13 
GeneralRemove Flicker before drawing Splash Screen Pin
Sukhjinder_K27-Mar-08 21:47
Sukhjinder_K27-Mar-08 21:47 
Creating Spalsh Screen from an Image in C#

Hi I need to create a Splash Screen from an Image file. The Splash Screen form should be of the same dimensions as the image file. The program should hide the Splash Screen when my MainForm is displayed.

Here is what I'm doing
class SplashScreen : Form
{
	Image splashImage;
	public SplashScreen()
	{
		
		this.TopMost = true;
		this.ShowInTaskbar = false;
		this.FormBorderStyle = FormBorderStyle.None;
		this.StartPosition = FormStartPosition.CenterScreen;
			
		this.BackColor = this.TransparencyKey = Color.White;
		Image img = Bitmap.FromFile("splash.png");
		Bitmap b = new Bitmap(img);
		b.MakeTransparent(b.GetPixel(1,1));
		this.BackgroundImage = splashImage = (Image) b;
		this.Size = this.splashImage.Size;
	}
}
class MainForm : Form
{
	public static void main(String[] args)
	{
		// Some Code
		SplashScreen splash = new SplashScreen();
		splash.Show();
			
		MainForm mainForm = new MainForm();
			
		mainForm.Shown += delegate(object o, EventArgs ev)
		{
			splash.Hide();		//Hide and Dispose the Splash Form When mainForm is shown for the first Time
			splash.Dispose();
			mainForm.GetFocus();
		};
		// More Code
	}
}

The Splash File to be used is available here.
With the above code I do get the splash screen and the behaviour as expected but before the splash screen is drawn I see a Black Rectangle flashing, with same dimensions as the splash image.

Please suggest. If you have a different approach please go ahead. All I want is to see a nice Splash Screen

Thanks
Sukhjinder
http://sukhjinder.cn/
GeneralRe: Remove Flicker before drawing Splash Screen Pin
Bekjong28-Mar-08 0:32
Bekjong28-Mar-08 0:32 
GeneralThe Solution I got Pin
Sukhjinder_K29-Mar-08 23:19
Sukhjinder_K29-Mar-08 23:19 
GeneralLine Eraser [modified] Pin
Denver Thomas27-Mar-08 21:15
Denver Thomas27-Mar-08 21:15 
GeneralRe: Line Eraser Pin
Xmen Real 27-Mar-08 23:06
professional Xmen Real 27-Mar-08 23:06 
General[Message Deleted] Pin
Denver Thomas27-Mar-08 23:07
Denver Thomas27-Mar-08 23:07 
GeneralRe: Line Eraser Pin
pmarfleet27-Mar-08 23:11
pmarfleet27-Mar-08 23:11 
General[Message Deleted] Pin
Denver Thomas28-Mar-08 0:37
Denver Thomas28-Mar-08 0:37 
GeneralRe: Line Eraser Pin
pmarfleet28-Mar-08 1:53
pmarfleet28-Mar-08 1:53 
GeneralRe: Line Eraser Pin
J4amieC28-Mar-08 2:05
J4amieC28-Mar-08 2:05 
GeneralRe: Line Eraser Pin
pmarfleet27-Mar-08 23:10
pmarfleet27-Mar-08 23:10 
GeneralRe: Line Eraser Pin
Denver Thomas27-Mar-08 23:17
Denver Thomas27-Mar-08 23:17 
Generalto Paul Marfleet Pin
Denver Thomas28-Mar-08 0:53
Denver Thomas28-Mar-08 0:53 
GeneralRe: to Paul Marfleet Pin
J4amieC28-Mar-08 1:17
J4amieC28-Mar-08 1:17 
GeneralRe: to Paul Marfleet Pin
pmarfleet28-Mar-08 1:59
pmarfleet28-Mar-08 1:59 
QuestionCalling HTTP Web Form and posting information [modified] Pin
ptr2void27-Mar-08 20:59
ptr2void27-Mar-08 20:59 
AnswerRe: Calling HTTP Web Form and posting information Pin
Rajesh Thomas28-Mar-08 2:21
Rajesh Thomas28-Mar-08 2:21 
AnswerRe: Calling HTTP Web Form and posting information Pin
Ravi Bhavnani1-May-08 7:59
professionalRavi Bhavnani1-May-08 7:59 

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.