关于有启动界面的问题!
就是说在启动主窗体前先启动另一个窗体(这个窗体一般是比较漂亮的窗体),几秒后主窗体启动。偶希望有高人指点,谢谢~~~~~~~~
最好把你的源码发进我的邮箱qkyang_cumt@126.com
代码如下:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms; 
namespace 教务系统
{
/// <summary>
/// frmRun 的摘要说明。
/// </summary>
public class frmRun : System.Windows.Forms.Form
{
  private System.Windows.Forms.Timer timer1;
  private System.Windows.Forms.PictureBox pictureBox1;
  private System.Windows.Forms.Label label1;
  private System.ComponentModel.IContainer components;
  public frmRun()
  {
   //
   // 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.timer1 = new System.Windows.Forms.Timer(this.components);
   this.pictureBox1 = new System.Windows.Forms.PictureBox();
   this.label1 = new System.Windows.Forms.Label();
   this.SuspendLayout();
   // 
   // timer1
   // 
   this.timer1.Interval = 2000;
   this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
   // 
   // pictureBox1
   // 
   this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
   this.pictureBox1.Location = new System.Drawing.Point(0, 0);
   this.pictureBox1.Name = "pictureBox1";
   this.pictureBox1.Size = new System.Drawing.Size(350, 218);
   this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
   this.pictureBox1.TabIndex = 0;
   this.pictureBox1.TabStop = false;
   this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
   // 
   // label1
   // 
   this.label1.BackColor = System.Drawing.Color.White;
   this.label1.Font = new System.Drawing.Font("华文行楷", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
   this.label1.Location = new System.Drawing.Point(96, 24);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(24, 160);
   this.label1.TabIndex = 3;
   this.label1.Text = "教务管理系统";
   // 
   // frmRun
   // 
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.BackColor = System.Drawing.Color.LightGray;
   this.ClientSize = new System.Drawing.Size(344, 208);
   this.Controls.Add(this.label1);
   this.Controls.Add(this.pictureBox1);
   this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
   this.Name = "frmRun";
   this.Opacity = 0.7;
   this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   this.Text = "frmRun";
   this.Load += new System.EventHandler(this.frmRun_Load);
   this.ResumeLayout(false);
  }
  #endregion
  private void frmRun_Load(object sender, System.EventArgs e)
  {
   try
   {
    this.pictureBox1.Image=Image.FromFile(Application.StartupPath+"\\logo.jpg");
   }
   catch
   {
    this.Close();
   }
   this.timer1.Start();
  }
  private void timer1_Tick(object sender, System.EventArgs e)
  {
   this.timer1.Stop();
   this.timer1.Enabled=false;
   this.Close();
   this.Dispose(true);
  }
  private void pictureBox1_Click(object sender, System.EventArgs e)
  {
   this.timer1.Stop();
   this.timer1.Enabled=false;
   this.timer1=null;
   this.Close();
   this.Dispose(true);
  }
  
}
}
以下为启动窗体代码:
private void frmLogin_Load(object sender, System.EventArgs e)
  {
   frmRun run=new frmRun();
   run.ShowDialog();
   try
   {
    this.btnInfo.Image=Image.FromFile(Application.StartupPath+"\\关于.ico");
   }
   catch
   {
    Application.Exit();
   }
   RegistryKey key=Registry.LocalMachine.CreateSubKey("software\\TeachingBusiness\\RunState");    //得到注册表项
   string runstate=key.GetValue("run").ToString();      //得到run键的值
   if(runstate=="Manager")
    frmLogin.Students=false;
   else
    frmLogin.Students=true;
   IsStudent.Checked=frmLogin.Students;      //得到启动设置
   this.timer1.Enabled=true;
  }
