📄 frmstuinfo.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace prjClass
{
/// <summary>
/// frmStuInfo 的摘要说明。
/// </summary>
public class frmStuInfo : System.Windows.Forms.Form
{
private StuInfo stu = new StuInfo();
private bool flag = false;
private Class1 c = new Class1();
private DataAccess da = new DataAccess();
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.ComboBox cboSpec;
private System.Windows.Forms.ComboBox cboClass;
private System.Windows.Forms.TextBox txtYeay;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnEdit;
private System.Windows.Forms.Button btnDel;
private System.Windows.Forms.Button btnCancle;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public frmStuInfo()
{
//
// 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.panel1 = new System.Windows.Forms.Panel();
this.btnCancle = new System.Windows.Forms.Button();
this.btnDel = new System.Windows.Forms.Button();
this.btnEdit = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.txtYeay = new System.Windows.Forms.TextBox();
this.cboClass = new System.Windows.Forms.ComboBox();
this.cboSpec = new System.Windows.Forms.ComboBox();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.btnCancle);
this.panel1.Controls.Add(this.btnDel);
this.panel1.Controls.Add(this.btnEdit);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 665);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1028, 80);
this.panel1.TabIndex = 0;
//
// btnCancle
//
this.btnCancle.Location = new System.Drawing.Point(712, 32);
this.btnCancle.Name = "btnCancle";
this.btnCancle.Size = new System.Drawing.Size(120, 23);
this.btnCancle.TabIndex = 2;
this.btnCancle.Text = "取 消";
this.btnCancle.Click += new System.EventHandler(this.btnCancle_Click);
//
// btnDel
//
this.btnDel.Location = new System.Drawing.Point(454, 32);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(120, 23);
this.btnDel.TabIndex = 1;
this.btnDel.Text = "删除学生信息";
this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
//
// btnEdit
//
this.btnEdit.Location = new System.Drawing.Point(176, 32);
this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new System.Drawing.Size(120, 23);
this.btnEdit.TabIndex = 0;
this.btnEdit.Text = "修改学生信息";
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
//
// panel2
//
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.txtYeay);
this.panel2.Controls.Add(this.cboClass);
this.panel2.Controls.Add(this.cboSpec);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1028, 72);
this.panel2.TabIndex = 1;
//
// label3
//
this.label3.Location = new System.Drawing.Point(32, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 20);
this.label3.TabIndex = 5;
this.label3.Text = "专业";
//
// label2
//
this.label2.Location = new System.Drawing.Point(584, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 20);
this.label2.TabIndex = 4;
this.label2.Text = "班级";
//
// label1
//
this.label1.Location = new System.Drawing.Point(312, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 20);
this.label1.TabIndex = 3;
this.label1.Text = "入学年份";
//
// txtYeay
//
this.txtYeay.Location = new System.Drawing.Point(376, 24);
this.txtYeay.Name = "txtYeay";
this.txtYeay.Size = new System.Drawing.Size(168, 21);
this.txtYeay.TabIndex = 2;
this.txtYeay.Text = "";
this.txtYeay.TextChanged += new System.EventHandler(this.txtYeay_TextChanged);
this.txtYeay.Leave += new System.EventHandler(this.txtYeay_Leave);
//
// cboClass
//
this.cboClass.Location = new System.Drawing.Point(648, 24);
this.cboClass.Name = "cboClass";
this.cboClass.Size = new System.Drawing.Size(168, 20);
this.cboClass.TabIndex = 1;
this.cboClass.Text = "comboBox2";
this.cboClass.SelectedIndexChanged += new System.EventHandler(this.cboClass_SelectedIndexChanged);
//
// cboSpec
//
this.cboSpec.Location = new System.Drawing.Point(96, 24);
this.cboSpec.Name = "cboSpec";
this.cboSpec.Size = new System.Drawing.Size(168, 20);
this.cboSpec.TabIndex = 0;
this.cboSpec.Text = "comboBox1";
this.cboSpec.SelectedIndexChanged += new System.EventHandler(this.cboSpec_SelectedIndexChanged);
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 72);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(1028, 593);
this.dataGrid1.TabIndex = 2;
this.dataGrid1.GotFocus += new System.EventHandler(this.dataGrid1_GotFocus);
this.dataGrid1.CurrentCellChanged += new System.EventHandler(this.dataGrid1_CurrentCellChanged);
//
// frmStuInfo
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(1028, 745);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "frmStuInfo";
this.Text = "学生信息浏览";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.frmStuInfo_Load);
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void frmStuInfo_Load(object sender, System.EventArgs e)
{
setDataGridStyle();
this.txtYeay.Text=DateTime.Now.Year.ToString();
string Sql = "select * from Class..SpecialtyInfo";
if(c.IsExits(Sql)==true)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -