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

📄 form1.cs

📁 图书馆里系统 很好的计算机毕业设计的参考 资料 里面有PPT和 文档资料 大家来顶一下
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Admin
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.TextBox textBox3;
		private System.Windows.Forms.TextBox textBox4;
		private System.Windows.Forms.RichTextBox richTextBox1;
		private System.Windows.Forms.DataGrid dataGrid1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.Button button4;
		private System.Windows.Forms.Button button5;
		private System.Windows.Forms.Button button6;
		private wc.Service1  s;
		/// <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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.textBox2 = new System.Windows.Forms.TextBox();
			this.textBox3 = new System.Windows.Forms.TextBox();
			this.textBox4 = new System.Windows.Forms.TextBox();
			this.richTextBox1 = new System.Windows.Forms.RichTextBox();
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.button4 = new System.Windows.Forms.Button();
			this.button5 = new System.Windows.Forms.Button();
			this.button6 = new System.Windows.Forms.Button();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.Color.Aquamarine;
			this.label1.Location = new System.Drawing.Point(32, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(88, 23);
			this.label1.TabIndex = 0;
			this.label1.Text = "ISBN";
			// 
			// label2
			// 
			this.label2.BackColor = System.Drawing.Color.Aquamarine;
			this.label2.Location = new System.Drawing.Point(32, 64);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(88, 23);
			this.label2.TabIndex = 1;
			this.label2.Text = "Title";
			// 
			// label3
			// 
			this.label3.BackColor = System.Drawing.Color.Aquamarine;
			this.label3.Location = new System.Drawing.Point(32, 104);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(88, 23);
			this.label3.TabIndex = 2;
			this.label3.Text = "Author";
			// 
			// label4
			// 
			this.label4.BackColor = System.Drawing.Color.Aquamarine;
			this.label4.Location = new System.Drawing.Point(32, 144);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(88, 23);
			this.label4.TabIndex = 3;
			this.label4.Text = "Publisher";
			// 
			// label5
			// 
			this.label5.BackColor = System.Drawing.Color.Aquamarine;
			this.label5.Location = new System.Drawing.Point(32, 208);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(88, 23);
			this.label5.TabIndex = 4;
			this.label5.Text = "Brief";
			// 
			// textBox1
			// 
			this.textBox1.BackColor = System.Drawing.Color.MediumSpringGreen;
			this.textBox1.Location = new System.Drawing.Point(168, 24);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(176, 21);
			this.textBox1.TabIndex = 5;
			this.textBox1.Text = "";
			this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
			// 
			// textBox2
			// 
			this.textBox2.BackColor = System.Drawing.Color.MediumSpringGreen;
			this.textBox2.Location = new System.Drawing.Point(168, 72);
			this.textBox2.Name = "textBox2";
			this.textBox2.Size = new System.Drawing.Size(176, 21);
			this.textBox2.TabIndex = 6;
			this.textBox2.Text = "";
			this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
			// 
			// textBox3
			// 
			this.textBox3.BackColor = System.Drawing.Color.MediumSpringGreen;
			this.textBox3.Location = new System.Drawing.Point(168, 104);
			this.textBox3.Name = "textBox3";
			this.textBox3.Size = new System.Drawing.Size(176, 21);
			this.textBox3.TabIndex = 7;
			this.textBox3.Text = "";
			this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
			// 
			// textBox4
			// 
			this.textBox4.BackColor = System.Drawing.Color.MediumSpringGreen;
			this.textBox4.Location = new System.Drawing.Point(168, 144);
			this.textBox4.Name = "textBox4";
			this.textBox4.Size = new System.Drawing.Size(176, 21);
			this.textBox4.TabIndex = 8;
			this.textBox4.Text = "";
			this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged);
			// 
			// richTextBox1
			// 
			this.richTextBox1.BackColor = System.Drawing.Color.MediumSpringGreen;
			this.richTextBox1.Location = new System.Drawing.Point(168, 200);
			this.richTextBox1.Name = "richTextBox1";
			this.richTextBox1.Size = new System.Drawing.Size(176, 48);
			this.richTextBox1.TabIndex = 9;
			this.richTextBox1.Text = "";
			// 
			// dataGrid1
			// 
			this.dataGrid1.AlternatingBackColor = System.Drawing.Color.White;
			this.dataGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left)));
			this.dataGrid1.BackColor = System.Drawing.Color.White;
			this.dataGrid1.BackgroundColor = System.Drawing.Color.Ivory;
			this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.dataGrid1.CaptionBackColor = System.Drawing.Color.DarkSlateBlue;
			this.dataGrid1.CaptionForeColor = System.Drawing.Color.Lavender;
			this.dataGrid1.DataMember = "";
			this.dataGrid1.FlatMode = true;
			this.dataGrid1.Font = new System.Drawing.Font("Tahoma", 8F);
			this.dataGrid1.ForeColor = System.Drawing.Color.Black;
			this.dataGrid1.GridLineColor = System.Drawing.Color.Wheat;
			this.dataGrid1.HeaderBackColor = System.Drawing.Color.CadetBlue;
			this.dataGrid1.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
			this.dataGrid1.HeaderForeColor = System.Drawing.Color.Black;
			this.dataGrid1.LinkColor = System.Drawing.Color.DarkSlateBlue;
			this.dataGrid1.Location = new System.Drawing.Point(0, 264);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.ParentRowsBackColor = System.Drawing.Color.Ivory;
			this.dataGrid1.ParentRowsForeColor = System.Drawing.Color.Black;
			this.dataGrid1.SelectionBackColor = System.Drawing.Color.Wheat;
			this.dataGrid1.SelectionForeColor = System.Drawing.Color.DarkSlateBlue;
			this.dataGrid1.Size = new System.Drawing.Size(440, 224);
			this.dataGrid1.TabIndex = 10;
			// 
			// button1
			// 
			this.button1.BackColor = System.Drawing.Color.Aquamarine;
			this.button1.Location = new System.Drawing.Point(408, 24);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(96, 23);
			this.button1.TabIndex = 11;
			this.button1.Text = "查看所有信息";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.BackColor = System.Drawing.Color.Aquamarine;
			this.button2.Location = new System.Drawing.Point(408, 80);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(96, 23);
			this.button2.TabIndex = 12;
			this.button2.Text = "查看单条记录";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// button3
			// 
			this.button3.BackColor = System.Drawing.Color.Aquamarine;
			this.button3.Location = new System.Drawing.Point(408, 136);
			this.button3.Name = "button3";
			this.button3.Size = new System.Drawing.Size(96, 23);
			this.button3.TabIndex = 13;
			this.button3.Text = "添加";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// button4
			// 
			this.button4.BackColor = System.Drawing.Color.Aquamarine;
			this.button4.Location = new System.Drawing.Point(408, 192);
			this.button4.Name = "button4";
			this.button4.Size = new System.Drawing.Size(96, 23);
			this.button4.TabIndex = 14;
			this.button4.Text = "删除";
			this.button4.Click += new System.EventHandler(this.button4_Click);
			// 
			// button5
			// 
			this.button5.BackColor = System.Drawing.Color.Aquamarine;
			this.button5.Location = new System.Drawing.Point(544, 24);
			this.button5.Name = "button5";
			this.button5.TabIndex = 15;
			this.button5.Text = "更新";
			this.button5.Click += new System.EventHandler(this.button5_Click);
			// 
			// button6
			// 
			this.button6.BackColor = System.Drawing.Color.Aquamarine;
			this.button6.Location = new System.Drawing.Point(656, 24);
			this.button6.Name = "button6";
			this.button6.TabIndex = 16;
			this.button6.Text = "退出";
			this.button6.Click += new System.EventHandler(this.button6_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(736, 478);
			this.Controls.Add(this.button6);
			this.Controls.Add(this.button5);
			this.Controls.Add(this.button4);
			this.Controls.Add(this.button3);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.richTextBox1);
			this.Controls.Add(this.textBox4);
			this.Controls.Add(this.textBox3);
			this.Controls.Add(this.textBox2);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Name = "Form1";
			this.Text = "管理员界面";
			this.Load += new System.EventHandler(this.Form1_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

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

		private void Form1_Load(object sender, System.EventArgs e)
		{
			s=new Admin.wc.Service1(); 
		}

		private void textBox3_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void textBox2_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void textBox1_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void textBox4_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void button6_Click(object sender, System.EventArgs e)
		{
			this.Close(); 
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			dataGrid1.DataSource=s.See(); 
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
		   dataGrid1.DataSource=s.See1(textBox1.Text);  
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
			bool t=s.Add(textBox1.Text,textBox2.Text,textBox3.Text,textBox4.Text,richTextBox1.Text);
			if(t==true)
			{
				MessageBox.Show("恭喜你,","插入操作成功!",MessageBoxButtons.OK ,MessageBoxIcon.Information); 
			}
			else
			{
				MessageBox.Show("很抱歉,","插入操作没能成功!",MessageBoxButtons.OK ,MessageBoxIcon.Information); 
			}
		}

		private void button4_Click(object sender, System.EventArgs e)
		{
			
				bool t=s.Delete(textBox1.Text); 
				if(t==true)
				{
					MessageBox.Show("恭喜你!","删除操作成功",MessageBoxButtons.OK,MessageBoxIcon.Information) ;
				}
				else
				{
					MessageBox.Show("很抱歉!","删除操作没能成功执行",MessageBoxButtons.OK,MessageBoxIcon.Information);
				}
			
		}

		private void button5_Click(object sender, System.EventArgs e)
		{
			bool t=s.Update(textBox1.Text,textBox2.Text,textBox3.Text,textBox4.Text,richTextBox1.Text); 
			if(t==true)
			{
				MessageBox.Show("恭喜你!","更新操作成功",MessageBoxButtons.OK,MessageBoxIcon.Information) ;
			}
			else
			{
				MessageBox.Show("很抱歉!","删除操作没能成功",MessageBoxButtons.OK,MessageBoxIcon.Information) ;
			}		
		}
	}
}

⌨️ 快捷键说明

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