📄 splashform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Data;
using System.Data.SqlClient;
namespace bizdb
{
/// <summary>
/// Summary description for SplashForm.
/// </summary>
public class SplashForm : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label lStatusInfo;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public SplashForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
public string StatusInfo
{
set
{
_StatusInfo = value;
ChangeStatusText();
}
get
{
return _StatusInfo;
}
}
public void ChangeStatusText()
{
try
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(this.ChangeStatusText));
return;
}
lStatusInfo.Text = _StatusInfo;
}
catch
{
// do something here...
}
}
private string _StatusInfo = "";
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SplashForm));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.lStatusInfo = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(320, 280);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// lStatusInfo
//
this.lStatusInfo.Font = new System.Drawing.Font("Arial Black", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lStatusInfo.ForeColor = System.Drawing.SystemColors.HotTrack;
this.lStatusInfo.Location = new System.Drawing.Point(112, 288);
this.lStatusInfo.Name = "lStatusInfo";
this.lStatusInfo.Size = new System.Drawing.Size(168, 24);
this.lStatusInfo.TabIndex = 1;
//
// SplashForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(320, 328);
this.Controls.Add(this.lStatusInfo);
this.Controls.Add(this.pictureBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "SplashForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SplashForm";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SplashForm_KeyDown);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.SplashForm_KeyPress);
this.Load += new System.EventHandler(this.SplashForm_Load);
this.ResumeLayout(false);
}
#endregion
private void SplashForm_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
//if(e.KeyChar=='x')
//{
// Form_lj f = new Form_lj();
// Application.Run(f);
// this.Close();
//}
}
private void SplashForm_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
//if(e.Alt == true)
//{
// if(e.KeyValue==)
// {
// Form_lj f = new Form_lj();
// f.Show();
// this.Close();
// }
//}
}
static void Main()
{
Splasher.Show();
System.Threading.Thread.Sleep(4000);
Splasher.Status = "导入文件...";
System.Threading.Thread.Sleep(1000);
Splasher.Status = "导入组件...";
System.Threading.Thread.Sleep(1000);
Splasher.Status = "连接数据库...";
System.Threading.Thread.Sleep(1000);
Splasher.Close();
dbAccess db = new dbAccess();
common c = new common();
StreamReader srd;
// if(File.Exists("name.ini"))
// {
//
// srd = File.OpenText("name.ini");
// while(srd.Peek()!=-1)
// {
// String str = srd.ReadLine();
// c.sysname = str;
// }
// srd.Close();
// }
if(File.Exists("conn.ini"))
{
srd = File.OpenText("conn.ini");
while (srd.Peek()!=-1)
{
String str = srd.ReadLine();
db.connStr = str;
}
srd.Close();
SqlConnection myConn = new SqlConnection();
myConn.ConnectionString = db.connStr;
try
{
myConn.Open();
}
catch
{
MessageBox.Show("数据库连接失败,请重新配置数据库连接!",c.sysname+"业务运营与支持管理信息系统提示");
Application.Run(new Form_lj());
return;
}
Application.Run(new Form_logon());
}
else
{
Application.Run(new Form_lj());
}
}
private void SplashForm_Load(object sender, System.EventArgs e)
{
common c = new common();
this.Text = c.sysname+"业务运营与支持管理信息系统提示";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -