Special type form making: Launch welcome interface with C #

Source: Internet
Author: User
Tags static class

The first step: The main program launches the main form (represented here as Form1)

As follows:

static class Program
  {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main()
    {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      Application.Run(new Form1());
    }
  }

Step Two: Start the Welcome Interface (Form2) in the _load event in the main form (Form1)

As follows:

private void Form1_Load(object sender, EventArgs e)
    {
      //启动窗体
      Form2 MySplashForm = new Form2();
      MySplashForm.ShowDialog();
    }

Step three: Welcome the Control interface display mode and use timer to control the disappearing time of the Welcome interface (it often disappears after reading the configuration information that the system needs)

As follows:

private void Form2_Load(object sender, EventArgs e)
    {
      //设置启动窗体
      this.FormBorderStyle = FormBorderStyle.None;
      this.BackgroundImage = Image.FromFile("test.jpg");
      this.timer1.Start();
      this.timer1.Interval = 10000;
    }
    private void timer1_Tick(object sender, EventArgs e)
    {
      //...........读取系统配置
      //关闭启动窗体
      this.Close();
    }
    private void Form2_FormClosed(object sender, FormClosedEventArgs e)
    {
      //关闭定时器
      this.timer1.Stop();
    }

Article Source: http://www.cnblogs.com/ziyiFly/archive/2008/09/11/1288812.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.