我现在想做一个启动画面,也就是在点击按钮后,先出现启动画面,同时主画面也同时启动,等主画面加载完毕后,把启动画面关闭!
现在我做的是定时关闭启动画面,主画面一开始是隐藏,等关闭启动画面后再把主画面显示出来!
请问该怎么得到?
或者有类似更好的方法做启动画面的?请各位老师指导!

解决方案 »

  1.   

    如果你没有多线程加载的话,执行到form初始化的最后一句就是加载完毕的时候
      

  2.   

    to:fsdy2000(乡愁)
    请问具体怎么实现?
    FORM加载完毕后的判断标志是什么?
    有没有具体的确代码?
      

  3.   

    发消息,这个最保险了。Form_Load里发自定义消息。然后处理。肯定是加载结束了。
      

  4.   

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using System.Runtime.InteropServices;namespace TestInitForm
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.components = new System.ComponentModel.Container();
    this.Size = new System.Drawing.Size(300,300);
    this.Text = "Form1";
    PostMessage((int)Handle,1025,0,0);
    }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } [DllImport("user32.dll", EntryPoint="PostMessage")]
    public static extern int PostMessage (
    int hwnd,
    int wMsg,
    int wParam,
    int lParam
    ); protected override void WndProc(ref Message m)
    {
    if (m.Msg == 1025)
    {
    MessageBox.Show("Form initialize complate.");
    }
    base.WndProc (ref m);
    } }
    }
      

  5.   

    最简单的就这样行了,不过最好建议用多线程
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using System.Threading;namespace 启动画面
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Mains : System.Windows.Forms.Form
    {
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public Mains()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } private void Main_Load(object sender, System.EventArgs e)
    {
    this.Visible=false;
    fwin f=new fwin();
    f.Show();
    f.Refresh();
    Doing();
    f.Close();
    this.Visible=true;
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    // 
    // Main
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(292, 266);
    this.Name = "Main";
    this.Text = "Form1";
    this.Load += new System.EventHandler(this.Main_Load); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Mains());
    } void Doing()
    {
    Thread.Sleep(10000);
    }
    }
    }
      

  6.   

    上面的fwin是一个启动窗口的类