📄 mainform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Library.UserInterface
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button btnReader;
private System.Windows.Forms.Button btnBook;
private System.Windows.Forms.Button btnPublishing;
private System.Windows.Forms.Button btnBorrow;
private System.Windows.Forms.Button btnUser;
private System.Windows.Forms.Button btnQuery;
private System.Windows.Forms.Button btnExit;
private string userName;
private string userSort;
public MainForm(string username,string usersort)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.userName=username;
userSort=usersort;
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
this.btnReader = new System.Windows.Forms.Button();
this.btnBook = new System.Windows.Forms.Button();
this.btnPublishing = new System.Windows.Forms.Button();
this.btnBorrow = new System.Windows.Forms.Button();
this.btnUser = new System.Windows.Forms.Button();
this.btnQuery = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// btnReader
//
this.btnReader.BackColor = System.Drawing.Color.Navy;
this.btnReader.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnReader.ForeColor = System.Drawing.Color.White;
this.btnReader.Location = new System.Drawing.Point(240, 160);
this.btnReader.Name = "btnReader";
this.btnReader.Size = new System.Drawing.Size(80, 30);
this.btnReader.TabIndex = 9;
this.btnReader.TabStop = false;
this.btnReader.Text = "读者信息";
this.btnReader.Click += new System.EventHandler(this.btnReader_Click);
//
// btnBook
//
this.btnBook.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBook.ForeColor = System.Drawing.Color.White;
this.btnBook.Location = new System.Drawing.Point(240, 200);
this.btnBook.Name = "btnBook";
this.btnBook.Size = new System.Drawing.Size(80, 30);
this.btnBook.TabIndex = 10;
this.btnBook.Text = "图书信息";
this.btnBook.Click += new System.EventHandler(this.btnBook_Click);
//
// btnPublishing
//
this.btnPublishing.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnPublishing.ForeColor = System.Drawing.Color.White;
this.btnPublishing.Location = new System.Drawing.Point(360, 160);
this.btnPublishing.Name = "btnPublishing";
this.btnPublishing.Size = new System.Drawing.Size(80, 30);
this.btnPublishing.TabIndex = 11;
this.btnPublishing.Text = "出版社信息";
this.btnPublishing.Click += new System.EventHandler(this.btnPublishing_Click);
//
// btnBorrow
//
this.btnBorrow.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBorrow.ForeColor = System.Drawing.Color.White;
this.btnBorrow.Location = new System.Drawing.Point(240, 290);
this.btnBorrow.Name = "btnBorrow";
this.btnBorrow.Size = new System.Drawing.Size(80, 30);
this.btnBorrow.TabIndex = 12;
this.btnBorrow.Text = "读者借还书";
this.btnBorrow.Click += new System.EventHandler(this.btnBorrow_Click);
//
// btnUser
//
this.btnUser.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUser.ForeColor = System.Drawing.Color.White;
this.btnUser.Location = new System.Drawing.Point(360, 200);
this.btnUser.Name = "btnUser";
this.btnUser.Size = new System.Drawing.Size(80, 30);
this.btnUser.TabIndex = 13;
this.btnUser.Text = "用户信息";
this.btnUser.Click += new System.EventHandler(this.btnUser_Click);
//
// btnQuery
//
this.btnQuery.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnQuery.ForeColor = System.Drawing.Color.White;
this.btnQuery.Location = new System.Drawing.Point(360, 290);
this.btnQuery.Name = "btnQuery";
this.btnQuery.Size = new System.Drawing.Size(80, 30);
this.btnQuery.TabIndex = 15;
this.btnQuery.Text = "综合查询";
this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.Navy;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.ForeColor = System.Drawing.Color.White;
this.btnExit.Location = new System.Drawing.Point(300, 410);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(80, 30);
this.btnExit.TabIndex = 16;
this.btnExit.Text = "退出系统";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// pictureBox1
//
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(460, 50);
this.pictureBox1.TabIndex = 17;
this.pictureBox1.TabStop = false;
//
// pictureBox2
//
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(470, 0);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(50, 60);
this.pictureBox2.TabIndex = 18;
this.pictureBox2.TabStop = false;
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.Navy;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(522, 453);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnQuery);
this.Controls.Add(this.btnUser);
this.Controls.Add(this.btnBorrow);
this.Controls.Add(this.btnPublishing);
this.Controls.Add(this.btnBook);
this.Controls.Add(this.btnReader);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.Text = "图书管理信息系统";
this.Load += new System.EventHandler(this.MainForm_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
/*static void Main()
{
Application.Run(new MainForm("andy","andy"));
}*/
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void MainForm_Load(object sender, System.EventArgs e)
{
this.Text="图书馆管理系统 "+userName;
if(this.userSort=="system")
{
this.btnUser.Enabled=true;
}
else
{
this.btnUser.Enabled=false;
}
}
/*private void btnBook_Click(object sender, System.EventArgs e)
{
Form bookForm=new Book();
bookForm.ShowDialog();
}
private void btnReport_Click(object sender, System.EventArgs e)
{
Form reportForm=new Report();
reportForm.ShowDialog();
}*/
private void btnQuery_Click(object sender, System.EventArgs e)
{
Form QueryForm=new Query();
QueryForm.ShowDialog();
}
/*private void btnReader_Click(object sender, System.EventArgs e)
{
Form ReaderForm=new Reader();
ReaderForm.ShowDialog();
}*/
private void btnUser_Click(object sender, System.EventArgs e)
{
Form UserForm=new User();
UserForm.ShowDialog();
}
private void btnReader_Click(object sender, System.EventArgs e)
{
Form readerForm=new Reader();
readerForm.ShowDialog();
}
private void btnBook_Click(object sender, System.EventArgs e)
{
Form bookForm=new Book();
bookForm.ShowDialog();
}
private void btnBorrow_Click(object sender, System.EventArgs e)
{
Form bookForm=new BorrowReturn();
bookForm.ShowDialog();
}
private void btnPublishing_Click(object sender, System.EventArgs e)
{
Form publisForm=new Publishing();
publisForm.ShowDialog();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -