📄 frmsplash.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace SupermarketProject
{
/// <summary>
/// frmSplash
/// </summary>
public class frmSplash : System.Windows.Forms.Form
{
private System.ComponentModel.IContainer components;
private System.Windows.Forms.ProgressBar pgrSplash;
private System.Windows.Forms.Timer tmrTimer;
public Pen bluePen = new Pen(Color.Blue,3);
private int interval = 0;
private System.Windows.Forms.PictureBox pictureBox1;
private string userId;
public frmSplash(string usrId)
{
//
// Windows
//
InitializeComponent();
//
// TODO: InitializeComponent
//
userId = usrId;
}
/// <summary>
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
/*[STAThread]
static void Main()
{
Application.Run(new frmSplash());
}*/
#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(frmSplash));
this.tmrTimer = new System.Windows.Forms.Timer(this.components);
this.pgrSplash = new System.Windows.Forms.ProgressBar();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// tmrTimer
//
this.tmrTimer.Enabled = true;
this.tmrTimer.Interval = 30;
this.tmrTimer.Tick += new System.EventHandler(this.tmrTimer_Tick);
//
// pgrSplash
//
this.pgrSplash.Enabled = false;
this.pgrSplash.Location = new System.Drawing.Point(74, 240);
this.pgrSplash.Name = "pgrSplash";
this.pgrSplash.Size = new System.Drawing.Size(496, 16);
this.pgrSplash.Step = 1;
this.pgrSplash.TabIndex = 1;
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.SystemColors.Desktop;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(544, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(96, 56);
this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false;
//
// frmSplash
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
this.BackColor = System.Drawing.SystemColors.Desktop;
this.ClientSize = new System.Drawing.Size(644, 286);
this.ControlBox = false;
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.pgrSplash);
this.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmSplash";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.ResumeLayout(false);
}
#endregion
private void tmrTimer_Tick(object sender, System.EventArgs e)
{
interval = interval + 1;
pgrSplash.Value = interval;
if (interval == 100)
{
tmrTimer.Enabled=false;
this.Close();
}
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
Graphics g = pe.Graphics;
Font fnt = new Font("Verdana",15);
g.DrawString(this.userId + ",您好", fnt, new SolidBrush(Color.Beige),7,10);
fnt = new Font("Comic Sans Ms",20);
g.DrawString("欢迎访问 ", fnt, new SolidBrush(Color.Azure), 15,40);
fnt = new Font("Comic Sans Ms",40);
g.DrawString(" 祥 龙 超 市", fnt, new SolidBrush(Color.Red), 7,70);
fnt = new Font("Verdana",20);
g.DrawString("正在加载主菜单", fnt, new SolidBrush(Color.Yellow), 10,200);
fnt.Dispose();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -