如何用C#制作应用程序的启动欢迎界面,能不能给出详细的代码,谢谢,我使用定时器后欢迎界面关闭后,登陆窗口只是闪了一下就关闭了。

解决方案 »

  1.   

    static class Program {
                /// <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());    //启动主窗体
                }
            }
      

  2.   

    两种方式
    自己选吧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;
                }
            }
        }
      

  3.   

    http://www.cnblogs.com/cncxz/archive/2006/07/14/450987.html
      

  4.   

    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 指令或程序集引用?)
      

  5.   

    这个是2005的使用,只有2005才有Application.SetCompatibleTextRenderingDefault(false);这个句,所以如果2003就会报错,那2003中如何处理这个语句?谢谢
      

  6.   

    主界面部分:
                      [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是用来控制淡化的..你把时间频率改改就可以控制淡化速度.
      

  7.   

    最简单的,就是在 SplashFrm 放一个timer,简单方便。
      

  8.   

    try here
    http://www.codeproject.com/csharp/PrettyGoodSplashScreen.asp?target=splashForm
    http://www.codeproject.com/netcf/casoast.asp?target=splashForm
      

  9.   

    如果在主窗体中有太多要执行的项目,启动程序很慢,为了更快的响应用户
    在主窗体的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