📄 class.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using StudentManage.DataLevel;
namespace StudentManage.UILevel
{
/// <summary>
/// Class 的摘要说明。
/// </summary>
public class Class : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox textClaName;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textClaID;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnModify;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textStuNum;
private SqlConnection conn1=null;
private SqlDataAdapter sqlDataAdapter1=null;
private DataSet DataSetDep=new DataSet("Class");
private SqlCommand Command1=null;
private SqlDataReader DataReader1=null;
private string selectStr=null;
private string commandStr=null;
private System.Windows.Forms.ComboBox comboDep;
private System.Windows.Forms.Button CancelAll;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Class()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.conn1=new SqlConnection(DataLevel.Connection.ConnString);
this.selectStr="select * from Class";
this.Command1=new SqlCommand();
this.Command1.Connection=this.conn1;
this.sqlDataAdapter1=new SqlDataAdapter(this.selectStr,this.conn1);
//
// 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(Class));
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.comboDep = new System.Windows.Forms.ComboBox();
this.textStuNum = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textClaName = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textClaID = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnModify = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.btnDelete = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
this.CancelAll = new System.Windows.Forms.Button();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.comboDep);
this.groupBox2.Controls.Add(this.textStuNum);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.textClaName);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.textClaID);
this.groupBox2.Location = new System.Drawing.Point(16, 16);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(440, 96);
this.groupBox2.TabIndex = 4;
this.groupBox2.TabStop = false;
//
// comboDep
//
this.comboDep.Location = new System.Drawing.Point(272, 56);
this.comboDep.Name = "comboDep";
this.comboDep.Size = new System.Drawing.Size(152, 20);
this.comboDep.TabIndex = 8;
//
// textStuNum
//
this.textStuNum.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textStuNum.Location = new System.Drawing.Point(72, 56);
this.textStuNum.Name = "textStuNum";
this.textStuNum.Size = new System.Drawing.Size(72, 21);
this.textStuNum.TabIndex = 7;
this.textStuNum.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 56);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 23);
this.label4.TabIndex = 6;
this.label4.Text = "学生人数";
//
// textClaName
//
this.textClaName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textClaName.Location = new System.Drawing.Point(272, 24);
this.textClaName.Name = "textClaName";
this.textClaName.Size = new System.Drawing.Size(152, 21);
this.textClaName.TabIndex = 5;
this.textClaName.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(200, 56);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 23);
this.label3.TabIndex = 3;
this.label3.Text = "院系名称";
//
// label2
//
this.label2.Location = new System.Drawing.Point(200, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 23);
this.label2.TabIndex = 2;
this.label2.Text = "班级名称";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 31);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 23);
this.label1.TabIndex = 1;
this.label1.Text = "班级代码";
//
// textClaID
//
this.textClaID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textClaID.Location = new System.Drawing.Point(72, 24);
this.textClaID.Name = "textClaID";
this.textClaID.Size = new System.Drawing.Size(104, 21);
this.textClaID.TabIndex = 0;
this.textClaID.Text = "";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.CancelAll);
this.groupBox1.Controls.Add(this.btnModify);
this.groupBox1.Controls.Add(this.btnApply);
this.groupBox1.Controls.Add(this.btnAdd);
this.groupBox1.Controls.Add(this.btnExit);
this.groupBox1.Controls.Add(this.btnDelete);
this.groupBox1.Controls.Add(this.btnCancel);
this.groupBox1.Location = new System.Drawing.Point(16, 128);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(472, 56);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
//
// btnModify
//
this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnModify.Image = ((System.Drawing.Image)(resources.GetObject("btnModify.Image")));
this.btnModify.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnModify.Location = new System.Drawing.Point(88, 24);
this.btnModify.Name = "btnModify";
this.btnModify.Size = new System.Drawing.Size(56, 24);
this.btnModify.TabIndex = 105;
this.btnModify.Text = "修改";
this.btnModify.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
//
// btnApply
//
this.btnApply.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnApply.Image = ((System.Drawing.Image)(resources.GetObject("btnApply.Image")));
this.btnApply.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnApply.Location = new System.Drawing.Point(336, 24);
this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(56, 24);
this.btnApply.TabIndex = 102;
this.btnApply.Text = "确定";
this.btnApply.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// btnAdd
//
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Image = ((System.Drawing.Image)(resources.GetObject("btnAdd.Image")));
this.btnAdd.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAdd.Location = new System.Drawing.Point(24, 24);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(56, 24);
this.btnAdd.TabIndex = 103;
this.btnAdd.Text = "添加";
this.btnAdd.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Image = ((System.Drawing.Image)(resources.GetObject("btnExit.Image")));
this.btnExit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnExit.Location = new System.Drawing.Point(400, 24);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(56, 24);
this.btnExit.TabIndex = 100;
this.btnExit.Text = "退出";
this.btnExit.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnDelete
//
this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnDelete.Image")));
this.btnDelete.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDelete.Location = new System.Drawing.Point(152, 24);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(48, 24);
this.btnDelete.TabIndex = 104;
this.btnDelete.Text = "删除";
this.btnDelete.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// btnCancel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -