Click here to Skip to main content
16,007,163 members
Home / Discussions / C#
   

C#

 
GeneralRe: Printing an image in the middle of a page Pin
Paul Conrad23-Dec-07 9:57
professionalPaul Conrad23-Dec-07 9:57 
GeneralRe: Printing an image in the middle of a page Pin
devzav23-Dec-07 10:35
devzav23-Dec-07 10:35 
QuestionUsing Interfaces to force the creation of methods Pin
Clive D. Pottinger12-Dec-07 6:21
Clive D. Pottinger12-Dec-07 6:21 
GeneralRe: Using Interfaces to force the creation of methods Pin
Skippums12-Dec-07 6:44
Skippums12-Dec-07 6:44 
GeneralRe: Using Interfaces to force the creation of methods Pin
Clive D. Pottinger12-Dec-07 7:06
Clive D. Pottinger12-Dec-07 7:06 
GeneralRe: Using Interfaces to force the creation of methods Pin
Judah Gabriel Himango12-Dec-07 9:02
sponsorJudah Gabriel Himango12-Dec-07 9:02 
GeneralRe: Using Interfaces to force the creation of methods Pin
Pete O'Hanlon12-Dec-07 11:06
mvePete O'Hanlon12-Dec-07 11:06 
GeneralSplash Screen Shows Black before Showing Pin
Sukhjinder_K12-Dec-07 5:55
Sukhjinder_K12-Dec-07 5:55 
I'm drawing a Splash Screen (Custom Shaped WinForm) as follows

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;
			this.BackgroundImage = splashImage = Bitmap.FromFile(SplashFileName);
			this.Size = this.BackgroundImage.Size;			
		}
		protected override void OnPaint(PaintEventArgs e)
		{
			base.OnPaint(e);
			e.Graphics.DrawImage(this.splashImage, 0, 0, this.Width, this.Height);
		}
	}


and showing it in my Main method as

class MainForm : Form
{
	public static void Main(String[] args)
	{
		//Do something here
		
		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.Activate();
			mainForm.Focus();
		};
		//Do something more here
		mainForm.Show();
		Application.Run(mainForm);
        }
}

Now the Issue is that the Splash Screen shows fine as per the Image from "SplashFileName" but just before showing it shows a Black Rectangle for some milliseconds. What I expect is that the Splash Screen be shown while my program is loading stuff and hide as soon as the MainForm gets Shown. So Where am I missing?
Please Advice
Thanks...
GeneralRe: Splash Screen Shows Black before Showing Pin
Luc Pattyn12-Dec-07 7:23
sitebuilderLuc Pattyn12-Dec-07 7:23 
GeneralRemoving base.OnPaint(e) still does not help Pin
Sukhjinder_K12-Dec-07 16:22
Sukhjinder_K12-Dec-07 16:22 
GeneralRe: Removing base.OnPaint(e) still does not help Pin
Luc Pattyn13-Dec-07 7:22
sitebuilderLuc Pattyn13-Dec-07 7:22 
GeneralBut my Image is Non-Rectangular Pin
Sukhjinder_K13-Dec-07 22:11
Sukhjinder_K13-Dec-07 22:11 
GeneralGraphicsPaths and Scrolling Pin
DahrkDaiz12-Dec-07 5:38
DahrkDaiz12-Dec-07 5:38 
GeneralRe: GraphicsPaths and Scrolling Pin
Paul Conrad23-Dec-07 9:57
professionalPaul Conrad23-Dec-07 9:57 
GeneralCell phones application using c#.net Pin
mostafa_h12-Dec-07 5:26
mostafa_h12-Dec-07 5:26 
GeneralRe: Cell phones application using c#.net Pin
Sathesh Sakthivel12-Dec-07 6:57
Sathesh Sakthivel12-Dec-07 6:57 
GeneralRe: Cell phones application using c#.net Pin
mostafa_h12-Dec-07 9:49
mostafa_h12-Dec-07 9:49 
Generalc# event log size Pin
oi12-Dec-07 5:19
oi12-Dec-07 5:19 
GeneralDynamically instantiating a type and validating interface implementation Pin
Le centriste12-Dec-07 4:49
Le centriste12-Dec-07 4:49 
GeneralRe: Dynamically instantiating a type and validating interface implementation Pin
led mike12-Dec-07 5:11
led mike12-Dec-07 5:11 
GeneralRe: Dynamically instantiating a type and validating interface implementation Pin
m@u12-Dec-07 5:22
m@u12-Dec-07 5:22 
GeneralRe: Dynamically instantiating a type and validating interface implementation Pin
Le centriste12-Dec-07 5:54
Le centriste12-Dec-07 5:54 
Generaldeclaring form Pin
arkiboys12-Dec-07 4:35
arkiboys12-Dec-07 4:35 
GeneralRe: declaring form Pin
Kristian Sixhøj12-Dec-07 5:31
Kristian Sixhøj12-Dec-07 5:31 
GeneralRe: declaring form Pin
arkiboys12-Dec-07 5:50
arkiboys12-Dec-07 5:50 

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.