📄 employform.cs
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;using System.Data;
using System.Data.SqlClient;
namespace test007{ public class employForm : test007.PForm { private CurrencyManager cmAmend;
private DataSet ds = new DataSet();
private LinkDataBase link = new LinkDataBase();
private string sendTableName = "employee";
private string sendStrSQL = "SELECT 配送员帐号, 配送员姓名, 配送员密码, 配送城市 FROM employee";
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBox6; private System.ComponentModel.IContainer components = null; public employForm() { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); this.ds = link.SelectDataBase(sendStrSQL,sendTableName); dataGrid1.DataSource = ds.Tables[0]; DataGridStateControl();
DataBingingsFunction();
cmAmend =( CurrencyManager )BindingContext[ds.Tables[0]]; // TODO: 在 InitializeComponent 调用后添加任何初始化 } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Designer generated code /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// toolBar1
//
this.toolBar1.ButtonSize = new System.Drawing.Size(67, 35);
this.toolBar1.Visible = true;
//
// toolBarButton1
//
this.toolBarButton1.Rectangle = new System.Drawing.Rectangle(0, 2, 67, 35);
//
// toolBarButton2
//
this.toolBarButton2.Rectangle = new System.Drawing.Rectangle(67, 2, 67, 35);
//
// toolBarButton3
//
this.toolBarButton3.Rectangle = new System.Drawing.Rectangle(134, 2, 67, 35);
//
// toolBarButton4
//
this.toolBarButton4.Rectangle = new System.Drawing.Rectangle(201, 2, 67, 35);
//
// toolBarButton5
//
this.toolBarButton5.Rectangle = new System.Drawing.Rectangle(268, 2, 67, 35);
//
// toolBarButton6
//
this.toolBarButton6.Rectangle = new System.Drawing.Rectangle(335, 2, 67, 35);
//
// toolBarButton7
//
this.toolBarButton7.Rectangle = new System.Drawing.Rectangle(402, 2, 67, 35);
//
// toolBarButton8
//
this.toolBarButton8.Rectangle = new System.Drawing.Rectangle(469, 2, 67, 35);
//
// toolBarButton9
//
this.toolBarButton9.Rectangle = new System.Drawing.Rectangle(536, 2, 67, 35);
//
// groupBox1
//
this.groupBox1.Visible = true;
//
// button1
//
this.button1.Visible = true;
//
// label1
//
this.label1.Visible = true;
//
// textBox1
//
this.textBox1.Visible = true;
//
// label2
//
this.label2.Visible = true;
//
// textBox2
//
this.textBox2.Visible = true;
//
// dataGrid1
//
this.dataGrid1.AccessibleName = "DataGrid";
this.dataGrid1.AccessibleRole = System.Windows.Forms.AccessibleRole.Table;
this.dataGrid1.Visible = true;
//
// groupBox2
//
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox6,
this.textBox5,
this.textBox4,
this.textBox3});
this.groupBox2.Visible = true;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(24, 32);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(136, 21);
this.textBox3.TabIndex = 0;
this.textBox3.Text = "textBox3";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(240, 64);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(136, 21);
this.textBox4.TabIndex = 1;
this.textBox4.Text = "textBox4";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(64, 144);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(136, 21);
this.textBox5.TabIndex = 2;
this.textBox5.Text = "textBox5";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(256, 120);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(136, 21);
this.textBox6.TabIndex = 3;
this.textBox6.Text = "textBox6";
//
// employForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(652, 473);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.groupBox2,
this.dataGrid1,
this.groupBox1,
this.toolBar1});
this.Name = "employForm";
this.Load += new System.EventHandler(this.employForm_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
} #endregion private void DataGridStateControl()
{
DataGridTableStyle ts = new DataGridTableStyle();
ts.AlternatingBackColor = Color.LightGray;
ts.MappingName = this.ds.Tables[0].TableName;
ts.AllowSorting = false;
this.dataGrid1.TableStyles.Add(ts);
}
private void DataBingingsFunction()
{
this.textBox3.DataBindings.Add("Text",ds.Tables[0],"配送员帐号");
this.textBox4.DataBindings.Add("Text",ds.Tables[0],"配送员姓名");
this.textBox5.DataBindings.Add("Text",ds.Tables[0],"配送员密码");
this.textBox6.DataBindings.Add("Text",ds.Tables[0],"配送城市");
}
private void employForm_Load(object sender, System.EventArgs e)
{
} }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -