form1.cs

来自「小型图书馆管理系统能够实现图书馆用户信息和图书的存储以及查询。」· CS 代码 · 共 861 行 · 第 1/3 页

CS
861
字号
            this.ToolBarButton5.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // ToolBarButton6
            // 
            this.ToolBarButton6.Name = "ToolBarButton6";
            this.ToolBarButton6.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // TBExit
            // 
            this.TBExit.ImageIndex = 4;
            this.TBExit.Name = "TBExit";
            // 
            // ImageList1
            // 
            this.ImageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ImageList1.ImageStream")));
            this.ImageList1.TransparentColor = System.Drawing.Color.Transparent;
            this.ImageList1.Images.SetKeyName(0, "");
            this.ImageList1.Images.SetKeyName(1, "");
            this.ImageList1.Images.SetKeyName(2, "");
            this.ImageList1.Images.SetKeyName(3, "");
            this.ImageList1.Images.SetKeyName(4, "");
            // 
            // GroupBox2
            // 
            this.GroupBox2.Controls.Add(this.BtSave);
            this.GroupBox2.Controls.Add(this.BtEdit);
            this.GroupBox2.Controls.Add(this.BtDel);
            this.GroupBox2.Controls.Add(this.BtAdd);
            this.GroupBox2.Location = new System.Drawing.Point(8, 176);
            this.GroupBox2.Name = "GroupBox2";
            this.GroupBox2.Size = new System.Drawing.Size(272, 48);
            this.GroupBox2.TabIndex = 4;
            this.GroupBox2.TabStop = false;
            // 
            // BtSave
            // 
            this.BtSave.Location = new System.Drawing.Point(200, 16);
            this.BtSave.Name = "BtSave";
            this.BtSave.Size = new System.Drawing.Size(64, 23);
            this.BtSave.TabIndex = 0;
            this.BtSave.Text = "保存";
            this.BtSave.Click += new System.EventHandler(this.BtSave_Click);
            // 
            // BtEdit
            // 
            this.BtEdit.Location = new System.Drawing.Point(136, 16);
            this.BtEdit.Name = "BtEdit";
            this.BtEdit.Size = new System.Drawing.Size(64, 23);
            this.BtEdit.TabIndex = 0;
            this.BtEdit.Text = "编辑";
            this.BtEdit.Click += new System.EventHandler(this.BtEdit_Click);
            // 
            // BtDel
            // 
            this.BtDel.Location = new System.Drawing.Point(72, 16);
            this.BtDel.Name = "BtDel";
            this.BtDel.Size = new System.Drawing.Size(64, 23);
            this.BtDel.TabIndex = 0;
            this.BtDel.Text = "删除";
            this.BtDel.Click += new System.EventHandler(this.BtDel_Click);
            // 
            // BtAdd
            // 
            this.BtAdd.Location = new System.Drawing.Point(8, 16);
            this.BtAdd.Name = "BtAdd";
            this.BtAdd.Size = new System.Drawing.Size(64, 23);
            this.BtAdd.TabIndex = 0;
            this.BtAdd.Text = "添加";
            this.BtAdd.Click += new System.EventHandler(this.BtAdd_Click);
            // 
            // GroupBox3
            // 
            this.GroupBox3.Controls.Add(this.GroupBox5);
            this.GroupBox3.Controls.Add(this.GroupBox4);
            this.GroupBox3.Location = new System.Drawing.Point(8, 232);
            this.GroupBox3.Name = "GroupBox3";
            this.GroupBox3.Size = new System.Drawing.Size(272, 256);
            this.GroupBox3.TabIndex = 5;
            this.GroupBox3.TabStop = false;
            // 
            // GroupBox5
            // 
            this.GroupBox5.Controls.Add(this.GRDbooks);
            this.GroupBox5.Controls.Add(this.GroupBox6);
            this.GroupBox5.Location = new System.Drawing.Point(8, 80);
            this.GroupBox5.Name = "GroupBox5";
            this.GroupBox5.Size = new System.Drawing.Size(256, 168);
            this.GroupBox5.TabIndex = 1;
            this.GroupBox5.TabStop = false;
            // 
            // GRDbooks
            // 
            this.GRDbooks.DataMember = "";
            this.GRDbooks.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            this.GRDbooks.Location = new System.Drawing.Point(8, 64);
            this.GRDbooks.Name = "GRDbooks";
            this.GRDbooks.Size = new System.Drawing.Size(240, 96);
            this.GRDbooks.TabIndex = 1;
            // 
            // GroupBox6
            // 
            this.GroupBox6.Controls.Add(this.BtSearchID);
            this.GroupBox6.Controls.Add(this.txtSearchID);
            this.GroupBox6.Controls.Add(this.Label6);
            this.GroupBox6.Location = new System.Drawing.Point(8, 8);
            this.GroupBox6.Name = "GroupBox6";
            this.GroupBox6.Size = new System.Drawing.Size(240, 48);
            this.GroupBox6.TabIndex = 0;
            this.GroupBox6.TabStop = false;
            // 
            // BtSearchID
            // 
            this.BtSearchID.Location = new System.Drawing.Point(168, 16);
            this.BtSearchID.Name = "BtSearchID";
            this.BtSearchID.Size = new System.Drawing.Size(64, 24);
            this.BtSearchID.TabIndex = 2;
            this.BtSearchID.Text = "查询";
            this.BtSearchID.Click += new System.EventHandler(this.BtSearchID_Click);
            // 
            // txtSearchID
            // 
            this.txtSearchID.Location = new System.Drawing.Point(80, 16);
            this.txtSearchID.Name = "txtSearchID";
            this.txtSearchID.Size = new System.Drawing.Size(72, 21);
            this.txtSearchID.TabIndex = 1;
            // 
            // Label6
            // 
            this.Label6.Location = new System.Drawing.Point(8, 17);
            this.Label6.Name = "Label6";
            this.Label6.Size = new System.Drawing.Size(72, 16);
            this.Label6.TabIndex = 0;
            this.Label6.Text = "按图书编号查询";
            // 
            // GroupBox4
            // 
            this.GroupBox4.Controls.Add(this.Label5);
            this.GroupBox4.Controls.Add(this.Label4);
            this.GroupBox4.Controls.Add(this.BtSearch);
            this.GroupBox4.Controls.Add(this.txtSearch);
            this.GroupBox4.Controls.Add(this.Cmbtype);
            this.GroupBox4.Location = new System.Drawing.Point(8, 16);
            this.GroupBox4.Name = "GroupBox4";
            this.GroupBox4.Size = new System.Drawing.Size(256, 56);
            this.GroupBox4.TabIndex = 0;
            this.GroupBox4.TabStop = false;
            // 
            // Label5
            // 
            this.Label5.Location = new System.Drawing.Point(88, 16);
            this.Label5.Name = "Label5";
            this.Label5.Size = new System.Drawing.Size(56, 16);
            this.Label5.TabIndex = 3;
            this.Label5.Text = "查询条件";
            // 
            // Label4
            // 
            this.Label4.Location = new System.Drawing.Point(8, 17);
            this.Label4.Name = "Label4";
            this.Label4.Size = new System.Drawing.Size(56, 16);
            this.Label4.TabIndex = 3;
            this.Label4.Text = "查询类型";
            // 
            // BtSearch
            // 
            this.BtSearch.Location = new System.Drawing.Point(176, 24);
            this.BtSearch.Name = "BtSearch";
            this.BtSearch.Size = new System.Drawing.Size(64, 24);
            this.BtSearch.TabIndex = 2;
            this.BtSearch.Text = "查询";
            this.BtSearch.Click += new System.EventHandler(this.BtSearch_Click);
            // 
            // txtSearch
            // 
            this.txtSearch.Location = new System.Drawing.Point(88, 32);
            this.txtSearch.Name = "txtSearch";
            this.txtSearch.Size = new System.Drawing.Size(56, 21);
            this.txtSearch.TabIndex = 1;
            // 
            // Cmbtype
            // 
            this.Cmbtype.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.Cmbtype.DropDownWidth = 64;
            this.Cmbtype.Items.AddRange(new object[] {
            "图书编号",
            "图书名称",
            "图书总数量"});
            this.Cmbtype.Location = new System.Drawing.Point(8, 32);
            this.Cmbtype.Name = "Cmbtype";
            this.Cmbtype.Size = new System.Drawing.Size(64, 20);
            this.Cmbtype.TabIndex = 0;
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.ClientSize = new System.Drawing.Size(330, 517);
            this.Controls.Add(this.GroupBox3);
            this.Controls.Add(this.GroupBox2);
            this.Controls.Add(this.ToolBar1);
            this.Controls.Add(this.GroupBox1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.GroupBox1.ResumeLayout(false);
            this.GroupBox1.PerformLayout();
            this.GroupBox2.ResumeLayout(false);
            this.GroupBox3.ResumeLayout(false);
            this.GroupBox5.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.GRDbooks)).EndInit();
            this.GroupBox6.ResumeLayout(false);
            this.GroupBox6.PerformLayout();
            this.GroupBox4.ResumeLayout(false);
            this.GroupBox4.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

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

		private void ToolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			//工具条点击处理
			if(e.Button == TBfirst)
			{
				//如果点击了TBfirst按钮
				rownumber = 0;
				//记录移动到第一条
				TBNext.Enabled = true;
				//向后移动按钮设置为可以用
			}
			else if(e.Button ==TBpre)
			{
				//如果点击了TBpre按钮
				rownumber = rownumber - 1;
				//记录移动到前一条
				if(rownumber == -1)
				{
					//如果移动到了第一条
					TBpre.Enabled = false;
					//设置TBpre按钮为不可用
					return;
					//退出子程序
				}
				TBNext.Enabled = true;
				//向后移动按钮设置为可以用
			}
			else if(e.Button ==TBNext)
			{
				//如果点击了TBNext按钮
				rownumber = rownumber + 1;
				//记录移动到下一条
				if(rownumber == mytable.Rows.Count)
				{
					//如果移动到了最后一条
					TBNext.Enabled = false;
					//设置TBNext按钮为不可用
					return;
					//退出子程序
				}
				TBpre.Enabled = true;
				//向前移动按钮设置为可以用
			}
			else if(e.Button ==TBlast)
			{
				//如果点击了TBLast按钮
				rownumber = mytable.Rows.Count - 1;
				//记录移动到最后一条
				TBpre.Enabled = true;
				//向前移动按钮设置为可以用
			}
			else if(e.Button ==TBExit)
			{
				//如果点击了TBexit按钮
				DialogResult myresult;
				//定义对话框结果变量
				myresult = MessageBox.Show("要保存对图书信息的更改操作吗?"

⌨️ 快捷键说明

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