📄 startform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Sun188.iSBus.Common;
using Sun188.iSBus.DataAccess;
namespace Sun188.iSBus.WinUI
{
/// <summary>
/// StartForm 的摘要说明。
/// </summary>
public class StartForm : System.Windows.Forms.Form
{
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Timer timeShow;
private System.Windows.Forms.Timer timerUnLoad;
private MainForm mainForm;
private double showWin = 0;
private double HideWin = 1;
private System.Windows.Forms.Label label1;
private int stateValue = 0;
private int infoLength = 0;
private System.Windows.Forms.Timer timerShowInfo;
private System.Windows.Forms.Label lbInfo;
private string info = ">>>>>>";
public StartForm()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(StartForm));
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timeShow = new System.Windows.Forms.Timer(this.components);
this.timerUnLoad = new System.Windows.Forms.Timer(this.components);
this.label1 = new System.Windows.Forms.Label();
this.timerShowInfo = new System.Windows.Forms.Timer(this.components);
this.lbInfo = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(69, 220);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(320, 10);
this.progressBar1.TabIndex = 0;
//
// timer1
//
this.timer1.Interval = 50;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// timeShow
//
this.timeShow.Tick += new System.EventHandler(this.timeShow_Tick);
//
// timerUnLoad
//
this.timerUnLoad.Tick += new System.EventHandler(this.timerUnLoad_Tick);
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Location = new System.Drawing.Point(69, 204);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(122, 14);
this.label1.TabIndex = 2;
this.label1.Text = "请稍后!正在加载数据";
//
// timerShowInfo
//
this.timerShowInfo.Interval = 150;
this.timerShowInfo.Tick += new System.EventHandler(this.timerShowInfo_Tick);
//
// lbInfo
//
this.lbInfo.AutoSize = true;
this.lbInfo.BackColor = System.Drawing.Color.Transparent;
this.lbInfo.ForeColor = System.Drawing.Color.OrangeRed;
this.lbInfo.Location = new System.Drawing.Point(187, 203);
this.lbInfo.Name = "lbInfo";
this.lbInfo.Size = new System.Drawing.Size(42, 14);
this.lbInfo.TabIndex = 3;
this.lbInfo.Text = ">>>>>>";
this.lbInfo.Visible = false;
//
// StartForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(400, 280);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.lbInfo,
this.label1,
this.progressBar1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "StartForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "阳光公交宝典";
this.Load += new System.EventHandler(this.StartForm_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new StartForm());
}
private void timer1_Tick(object sender, System.EventArgs e)
{
this.timerShowInfo.Enabled = true;
this.timerShowInfo.Start();
this.stateValue += 1;
this.Login();
}
private void Login()
{
if(this.stateValue < 100)
{
this.progressBar1.Value = this.stateValue;
}
else
{
this.timer1.Stop();
this.timer1.Enabled = false;
this.timerShowInfo.Stop();
this.timerShowInfo.Enabled = false;
this.showWin = 0;
this.timerUnLoad.Enabled = true;
this.timerUnLoad.Start();
}
}
private void StartForm_Load(object sender, System.EventArgs e)
{
this.Opacity = this.showWin;
this.timeShow.Enabled = true;
this.timeShow.Start();
this.mainForm = new MainForm();
this.mainForm.Opacity = 0;
this.mainForm.Show();
}
private void timeShow_Tick(object sender, System.EventArgs e)
{
this.showWin += 0.1;
this.Opacity = this.showWin;
if(this.showWin >= 1 )
{
this.timeShow.Stop();
this.timeShow.Enabled = false;
this.timer1.Enabled = true;
this.timer1.Start();
}
}
private void timerUnLoad_Tick(object sender, System.EventArgs e)
{
this.HideWin -= 0.2;
this.showWin += 0.1;
this.Opacity = this.HideWin;
this.mainForm.Opacity = this.showWin;
if(this.showWin >= 1)
{
this.Hide();
this.timerUnLoad.Stop();
this.timerUnLoad.Enabled = false;
}
}
private void timerShowInfo_Tick(object sender, System.EventArgs e)
{
this.lbInfo.Visible = true;
this.infoLength += 1;
this.lbInfo.Text = this.info.Substring(0,this.infoLength);
if(this.infoLength >= this.info.Length)
{
this.infoLength = 0;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -