📄 form_main.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace 图书管理系统
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form_Main : System.Windows.Forms.Form
{
private System.ComponentModel.IContainer components;
public Form_Main()
{
//
// 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();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form_Main));
this.butExit = new System.Windows.Forms.Button();
this.butContactUs = new System.Windows.Forms.Button();
this.butBuyAndSale = new System.Windows.Forms.Button();
this.butStorage = new System.Windows.Forms.Button();
this.butCustomer = new System.Windows.Forms.Button();
this.butPublisher = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.panelInfo = new System.Windows.Forms.StatusBarPanel();
this.panelDate = new System.Windows.Forms.StatusBarPanel();
this.panelTime = new System.Windows.Forms.StatusBarPanel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
((System.ComponentModel.ISupportInitialize)(this.panelInfo)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.panelDate)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.panelTime)).BeginInit();
this.SuspendLayout();
//
// butExit
//
this.butExit.Image = ((System.Drawing.Image)(resources.GetObject("butExit.Image")));
this.butExit.Location = new System.Drawing.Point(0, 344);
this.butExit.Name = "butExit";
this.butExit.Size = new System.Drawing.Size(120, 64);
this.butExit.TabIndex = 11;
this.toolTip1.SetToolTip(this.butExit, "退出本系统");
this.butExit.Click += new System.EventHandler(this.butExit_Click);
//
// butContactUs
//
this.butContactUs.Image = ((System.Drawing.Image)(resources.GetObject("butContactUs.Image")));
this.butContactUs.Location = new System.Drawing.Point(0, 280);
this.butContactUs.Name = "butContactUs";
this.butContactUs.Size = new System.Drawing.Size(120, 64);
this.butContactUs.TabIndex = 10;
this.toolTip1.SetToolTip(this.butContactUs, "联系我们");
this.butContactUs.Click += new System.EventHandler(this.butContactUs_Click);
//
// butBuyAndSale
//
this.butBuyAndSale.Image = ((System.Drawing.Image)(resources.GetObject("butBuyAndSale.Image")));
this.butBuyAndSale.Location = new System.Drawing.Point(0, 216);
this.butBuyAndSale.Name = "butBuyAndSale";
this.butBuyAndSale.Size = new System.Drawing.Size(120, 64);
this.butBuyAndSale.TabIndex = 9;
this.toolTip1.SetToolTip(this.butBuyAndSale, "统计图书销售情况");
this.butBuyAndSale.Click += new System.EventHandler(this.butBuyAndSale_Click);
//
// butStorage
//
this.butStorage.Image = ((System.Drawing.Image)(resources.GetObject("butStorage.Image")));
this.butStorage.Location = new System.Drawing.Point(0, 144);
this.butStorage.Name = "butStorage";
this.butStorage.Size = new System.Drawing.Size(120, 72);
this.butStorage.TabIndex = 8;
this.toolTip1.SetToolTip(this.butStorage, "库存信息管理");
this.butStorage.Click += new System.EventHandler(this.butStorage_Click);
//
// butCustomer
//
this.butCustomer.Image = ((System.Drawing.Image)(resources.GetObject("butCustomer.Image")));
this.butCustomer.Location = new System.Drawing.Point(0, 72);
this.butCustomer.Name = "butCustomer";
this.butCustomer.Size = new System.Drawing.Size(120, 72);
this.butCustomer.TabIndex = 7;
this.butCustomer.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.toolTip1.SetToolTip(this.butCustomer, "客户信息管理");
this.butCustomer.Click += new System.EventHandler(this.butCustomer_Click);
//
// butPublisher
//
this.butPublisher.ForeColor = System.Drawing.SystemColors.ControlText;
this.butPublisher.Image = ((System.Drawing.Image)(resources.GetObject("butPublisher.Image")));
this.butPublisher.Location = new System.Drawing.Point(0, 0);
this.butPublisher.Name = "butPublisher";
this.butPublisher.Size = new System.Drawing.Size(120, 72);
this.butPublisher.TabIndex = 6;
this.butPublisher.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.toolTip1.SetToolTip(this.butPublisher, "出版社信息管理");
this.butPublisher.Click += new System.EventHandler(this.butPublisher_Click);
//
// panel1
//
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(120, 408);
this.panel1.TabIndex = 12;
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(120, 386);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.panelInfo,
this.panelDate,
this.panelTime});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(476, 22);
this.statusBar1.SizingGrip = false;
this.statusBar1.TabIndex = 14;
//
// panelInfo
//
this.panelInfo.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.panelInfo.Icon = ((System.Drawing.Icon)(resources.GetObject("panelInfo.Icon")));
this.panelInfo.Text = "欢迎使用本图书管理系统";
this.panelInfo.Width = 256;
//
// panelDate
//
this.panelDate.Icon = ((System.Drawing.Icon)(resources.GetObject("panelDate.Icon")));
this.panelDate.Width = 120;
//
// panelTime
//
this.panelTime.Icon = ((System.Drawing.Icon)(resources.GetObject("panelTime.Icon")));
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Form_Main
//
this.AutoScale = false;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(596, 408);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.butExit);
this.Controls.Add(this.butContactUs);
this.Controls.Add(this.butBuyAndSale);
this.Controls.Add(this.butStorage);
this.Controls.Add(this.butCustomer);
this.Controls.Add(this.butPublisher);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.IsMdiContainer = true;
this.MaximizeBox = false;
this.Name = "Form_Main";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "图书管理系统";
this.Load += new System.EventHandler(this.Form_Main_Load);
((System.ComponentModel.ISupportInitialize)(this.panelInfo)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.panelDate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.panelTime)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form_Main());
}
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button butExit;
private System.Windows.Forms.Button butContactUs;
private System.Windows.Forms.Button butBuyAndSale;
private System.Windows.Forms.Button butStorage;
private System.Windows.Forms.Button butCustomer;
private System.Windows.Forms.Button butPublisher;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel panelInfo;
private System.Windows.Forms.StatusBarPanel panelDate;
private System.Windows.Forms.StatusBarPanel panelTime;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.ToolTip toolTip1;
Form []child=new Form[6];
private void showChildForm(Form child)
{
child.MdiParent=this;
child.Location=new Point(0,0);
child.Show();
}
private void Form_Main_Load(object sender, System.EventArgs e)
{
child[0]= new Form_Welcome();
showChildForm(child[0]);
}
private void butPublisher_Click(object sender, System.EventArgs e)
{
if(Form_Welcome.submit)
{
child[1]=new Form_Publisher();
showChildForm(child[1]);
}
}
private void butCustomer_Click(object sender, System.EventArgs e)
{
if(Form_Welcome.submit)
{
child[2]=new Form_Customer();
showChildForm(child[2]);
}
}
private void butStorage_Click(object sender, System.EventArgs e)
{
if(Form_Welcome.submit)
{
child[3]=new Form_Storage();
showChildForm(child[3]);
}
}
private void butBuyAndSale_Click(object sender, System.EventArgs e)
{
if(Form_Welcome.submit)
{
child[4]=new Form_BuyAndSale();
showChildForm(child[4]);
}
}
private void butContactUs_Click(object sender, System.EventArgs e)
{
if(Form_Welcome.submit)
{
child[5]=new Form_ConnactUs();
showChildForm(child[5]);
}
}
private void butExit_Click(object sender, System.EventArgs e)
{
if(MessageBox.Show("确实要退出本系统吗","提示信息",MessageBoxButtons.YesNo)==DialogResult.Yes)
{
this.Close();
}
}
private void timer1_Tick(object sender, System.EventArgs e)
{
panelDate.Text=System.DateTime.Now.ToLongDateString();
panelTime.Text=System.DateTime.Now.ToLongTimeString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -