C:\Documents and Settings\sunqiang.SC\My Documents\Visual Studio Projects\test\Form1.cs(67): “System.Windows.Forms.Application”并不包含对“SetCompatibleTextRenderingDefault”的定义 C:\Documents and Settings\sunqiang.SC\My Documents\Visual Studio Projects\test\Form1.cs(71): 找不到类型或命名空间名称“Thread”(是否缺少 using 指令或程序集引用?)
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Login fmLogin = new Login();
fmLogin.Show();
Thread.Sleep(5000); // 延迟5秒
fmLogin.Close(); Application.Run(new HRDemoStart()); //启动主窗体
}
}
自己选吧static class Program {
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Login fmLogin = new Login(); // 当登陆窗体返回OK时进入主程序
if (fmLogin.ShowDialog() == DialogResult.OK) {
Application.Run(new HRDemoStart());
}
else {
Application.Exit(); return;
}
}
}
C:\Documents and Settings\sunqiang.SC\My Documents\Visual Studio Projects\test\Form1.cs(71): 找不到类型或命名空间名称“Thread”(是否缺少 using 指令或程序集引用?)
[STAThread]
static void Main()
{
About frm=new About();
frm.ShowDialog();
Application.Run(new SystemMain());
}启动画面窗体 private void About_Load(object sender, System.EventArgs e)
{ Timer1.Interval=25;
Timer1.Enabled=true;
Timer1.Elapsed+=new System.Timers.ElapsedEventHandler(Sshow);
Timer2.Interval=25;
Timer2.Elapsed+=new System.Timers.ElapsedEventHandler(Eshow);
Timer3.Interval=3000;
Timer3.Elapsed+=new System.Timers.ElapsedEventHandler(Wait);
} private void Sshow(object sender,System.Timers.ElapsedEventArgs e)
{
if(this.Opacity<1)
this.Opacity+=0.05;
else
{
Timer1.Stop();
Timer3.Start();
}
}
private void Eshow(object sender,System.Timers.ElapsedEventArgs e)
{
if(this.Opacity>0)
this.Opacity-=0.05;
else
{
Timer2.Stop();
this.Close();
}
}
private void Wait(object sender,System.Timers.ElapsedEventArgs e)
{
Timer3.Stop();
Timer2.Start();
}窗体部分的Timer是用来控制淡化的..你把时间频率改改就可以控制淡化速度.
http://www.codeproject.com/csharp/PrettyGoodSplashScreen.asp?target=splashForm
http://www.codeproject.com/netcf/casoast.asp?target=splashForm
在主窗体的load事件中,调用初始化窗体
主窗体的InitializeComponent();只要建立空窗体的代码,
其它代码全部复制出来,放到一个public方法中,这个public方法是在初始化窗体中调用
protected override void OnLoad(EventArgs e)
{
frmInit frminit = new frmInit();
//指明了初始化窗体的父级
frminit.Owner = this;
if (frminit.ShowDialog(this) == DialogResult.OK)
{
SetMinimumSize();
}// end if
else
{
this.Close();
this.Dispose();
Application.Exit();
}// end else if
base.OnLoad(e);
}// end void