Simple Splash Screens
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=40630.7 How do I display a splash screen type form, one with only client area (no border or titlebar)
http://www.syncfusion.com/faq/winforms/search/621.asp
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=40630.7 How do I display a splash screen type form, one with only client area (no border or titlebar)
http://www.syncfusion.com/faq/winforms/search/621.asp
using System.Windows.Forms;namespace mySplashScreen
{
class splashscreen : Form
{
private Form form1 ;
public static void Main(string[] args)
{
Application.Run(new splashscreen());
}
public splashscreen()
{
this.Text = "mySplashScreen";
this.Width = 600 ;
this.Height = 500 ;
form1 = new Form();
form1.FormBorderStyle = FormBorderStyle.None ;
form1.StartPosition = FormStartPosition.CenterScreen;
form1.ControlBox = false;
form1.BackColor = System.Drawing.Color.Blue;
form1.Show();
form1.TopMost = true;
form1.Click += new EventHandler(this.closeform);
form1.Refresh();
}
void closeform(object sender,EventArgs e)
{
form1.Close();
}
}
}
using System.Windows.Forms;namespace mySplashScreen
{
class splashscreen : Form
{
private Form form1 ;
public static void Main(string[] args)
{
Application.Run(new splashscreen());
}
public splashscreen()
{
this.Text = "mySplashScreen";
this.Width = 600 ;
this.Height = 500 ;
form1 = new Form();
form1.FormBorderStyle = FormBorderStyle.None ;
form1.StartPosition = FormStartPosition.CenterScreen;
form1.ControlBox = false;
form1.BackColor = System.Drawing.Color.Blue;
form1.Show();
form1.TopMost = true;
form1.Click += new EventHandler(this.closeform);
form1.Refresh();
}
void closeform(object sender,EventArgs e)
{
form1.Close();
}
}
}
it normally happens when Form_Load ends, that is when you should 关闭这个启动画面if you look at the first link above, basically, you can do something like:private void Form1_Load(object sender, System.EventArgs e)
{
// Display the splash screen
frmSplash SplashScreen = new frmSplash();
SplashScreen.Show(); // show the splash form and update text as events occur
SplashScreen.lblStatus.Text = "Helpful information here";
SplashScreen.lblStatus.Refresh();
//在这里装载你的控件们,连接数据库什么的 // Close the splash screen
SplashScreen.Close();
}
using System.Windows.Forms;namespace mySplashScreen
{
class splashscreen : Form
{
private Form form1 ;
private Button bt ;
public static void Main(string[] args)
{
Application.Run(new splashscreen());
}
public splashscreen()
{
ssload2();
this.Activated += new EventHandler(this.closeform);
this.Text = "mySplashScreen";
this.Width = 600 ;
this.Height = 500 ;
// 这里测试效果
int i ;
for(i=0;i<1500;i++)
{
bt = new Button();
this.Controls.Add(bt);
}
}
private void ssload2()
{
form1 = new Form();
form1.FormBorderStyle = FormBorderStyle.None ;
form1.StartPosition = FormStartPosition.CenterScreen;
form1.ControlBox = false;
form1.BackColor = System.Drawing.Color.Blue;
form1.Show();
form1.TopMost = true;
form1.Click += new EventHandler(this.closeform);
form1.Refresh();
}
void closeform(object sender,EventArgs e)
{
form1.Close();
}
}
}
我用C#开发了一个参数维护系统,可是每次运行程序,都至少要等超过3秒钟主窗口才蹦出来,这3秒钟真是难熬呀!
于是我就想像启动word那样,先出来一个画面,然后才出来那个主窗口,以利用这3秒多的时间。
如果像楼上各位老兄所说的,将SplashScreen.Show();放在form1_load这边,可是这时候我的主程序的窗口的所有控件都已经加载完了呀,不是一样要用户等3秒多的时间,并且在等了这么长的时间后,看到的还不是主窗口画面,而是一个图片,这好像与我的初衷不符呀!
麻烦各位高手不吝赐教了,一旦解决,马上给分!!!