⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.cs

📁 采用C#和SQL Server 2000开发 功能比较全面的图书馆管理系统
💻 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 Form1 : System.Windows.Forms.Form
	{
		internal System.Windows.Forms.MainMenu MainMenu1;
		internal System.Windows.Forms.MenuItem mnReader;
		internal System.Windows.Forms.MenuItem mnReaderType;
		internal System.Windows.Forms.MenuItem mnReaderDoc;
		internal System.Windows.Forms.MenuItem mnBook;
		internal System.Windows.Forms.MenuItem mnBookType;
		internal System.Windows.Forms.MenuItem mnBookDoc;
		internal System.Windows.Forms.MenuItem mnManage;
		internal System.Windows.Forms.MenuItem mnBuy;
		internal System.Windows.Forms.MenuItem mnBorrow;
		internal System.Windows.Forms.MenuItem mnReturn;
		internal System.Windows.Forms.MenuItem mnList;
		internal System.Windows.Forms.MenuItem mnMoney;
		internal System.Windows.Forms.MenuItem mnExit;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// 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.MainMenu1 = new System.Windows.Forms.MainMenu();
			this.mnReader = new System.Windows.Forms.MenuItem();
			this.mnReaderType = new System.Windows.Forms.MenuItem();
			this.mnReaderDoc = new System.Windows.Forms.MenuItem();
			this.mnBook = new System.Windows.Forms.MenuItem();
			this.mnBookType = new System.Windows.Forms.MenuItem();
			this.mnBookDoc = new System.Windows.Forms.MenuItem();
			this.mnManage = new System.Windows.Forms.MenuItem();
			this.mnBuy = new System.Windows.Forms.MenuItem();
			this.mnBorrow = new System.Windows.Forms.MenuItem();
			this.mnReturn = new System.Windows.Forms.MenuItem();
			this.mnList = new System.Windows.Forms.MenuItem();
			this.mnMoney = new System.Windows.Forms.MenuItem();
			this.mnExit = new System.Windows.Forms.MenuItem();
			// 
			// MainMenu1
			// 
			this.MainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.mnReader,
																					  this.mnBook,
																					  this.mnManage,
																					  this.mnExit});
			// 
			// mnReader
			// 
			this.mnReader.Index = 0;
			this.mnReader.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.mnReaderType,
																					 this.mnReaderDoc});
			this.mnReader.Text = "读者管理(&W)";
			// 
			// mnReaderType
			// 
			this.mnReaderType.Index = 0;
			this.mnReaderType.Text = "读者类别设置(&Y)";
			this.mnReaderType.Click += new System.EventHandler(this.mnReaderType_Click);
			// 
			// mnReaderDoc
			// 
			this.mnReaderDoc.Index = 1;
			this.mnReaderDoc.Text = "读者档案管理(&Z)";
			this.mnReaderDoc.Click += new System.EventHandler(this.mnReaderDoc_Click);
			// 
			// mnBook
			// 
			this.mnBook.Index = 1;
			this.mnBook.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																				   this.mnBookType,
																				   this.mnBookDoc});
			this.mnBook.Text = "图书管理(&X)";
			// 
			// mnBookType
			// 
			this.mnBookType.Index = 0;
			this.mnBookType.Text = "图书类别设置(&Y)";
			this.mnBookType.Click += new System.EventHandler(this.mnBookType_Click);
			// 
			// mnBookDoc
			// 
			this.mnBookDoc.Index = 1;
			this.mnBookDoc.Text = "图书档案管理(&Z)";
			this.mnBookDoc.Click += new System.EventHandler(this.mnBookDoc_Click);
			// 
			// mnManage
			// 
			this.mnManage.Index = 2;
			this.mnManage.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.mnBuy,
																					 this.mnBorrow,
																					 this.mnReturn,
																					 this.mnList,
																					 this.mnMoney});
			this.mnManage.Text = "流通管理(&Y)";
			// 
			// mnBuy
			// 
			this.mnBuy.Index = 0;
			this.mnBuy.Text = "图书征订(&V)";
			this.mnBuy.Click += new System.EventHandler(this.mnBuy_Click);
			// 
			// mnBorrow
			// 
			this.mnBorrow.Index = 1;
			this.mnBorrow.Text = "图书借阅(&W)";
			this.mnBorrow.Click += new System.EventHandler(this.mnBorrow_Click);
			// 
			// mnReturn
			// 
			this.mnReturn.Index = 2;
			this.mnReturn.Text = "图书归还(&X)";
			this.mnReturn.Click += new System.EventHandler(this.mnReturn_Click);
			// 
			// mnList
			// 
			this.mnList.Index = 3;
			this.mnList.Text = "逾期清单(&Y)";
			this.mnList.Click += new System.EventHandler(this.mnList_Click);
			// 
			// mnMoney
			// 
			this.mnMoney.Index = 4;
			this.mnMoney.Text = "图书罚款(&Z)";
			this.mnMoney.Click += new System.EventHandler(this.mnMoney_Click);
			// 
			// mnExit
			// 
			this.mnExit.Index = 3;
			this.mnExit.Text = "退出系统(&Z)";
			this.mnExit.Click += new System.EventHandler(this.mnExit_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(560, 294);
			this.IsMdiContainer = true;
			this.Menu = this.MainMenu1;
			this.Name = "Form1";
			this.Text = "图书馆管理系";

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private bool GetInstanceState( string name )
		{
			int l = this.MdiChildren.Length;
			for ( int i =0; i < l; i ++ )
			{
				if ( this.MdiChildren[ i ].Name == name )
				{
					this.MdiChildren[ i ].Focus();
					return true;
				}
			}
			return false;
		}

		private void mnReaderType_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmReaderType" ) )
				return;
			frmReaderType childFrm = new frmReaderType();
			childFrm.MdiParent = this;
			childFrm.Show();
		}

		private void mnReaderDoc_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmReaderDoc" ) )
				return;
			frmReaderDoc childFrm = new frmReaderDoc();
			childFrm.MdiParent = this;
			childFrm.Show();		
		}

		private void mnBookType_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmBookType" ) )
				return;
			frmBookType childFrm = new frmBookType();
			childFrm.MdiParent = this;
			childFrm.Show();
		}

		private void mnBookDoc_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmBookDoc" ) )
				return;
			frmBookDoc childFrm = new frmBookDoc();
			childFrm.MdiParent = this;
			childFrm.Show();
		}

		private void mnBuy_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmBuyBook" ) )
				return;
			frmBuyBook childFrm = new frmBuyBook();
			childFrm.MdiParent = this;
			childFrm.Show();
		}

		private void mnBorrow_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmBorrow" ) )
				return;
			frmBorrow childFrm = new frmBorrow();
			childFrm.MdiParent = this;
			childFrm.Show();
		}

		private void mnReturn_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmReturn" ) )
				return;
			frmReturn childFrm = new frmReturn();
			childFrm.MdiParent = this;
			childFrm.Show();
		}

		private void mnList_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmList" ) )
				return;
			frmList childFrm = new frmList();
			childFrm.MdiParent = this;
			childFrm.Show();
		}

		private void mnMoney_Click(object sender, System.EventArgs e)
		{
			if ( GetInstanceState( "frmMoney" ) )
				return;
			frmMoney childFrm = new frmMoney();
			childFrm.MdiParent = this;
			childFrm.Show();
		}

		private void mnExit_Click(object sender, System.EventArgs e)
		{
			Application.Exit();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -