?? fromdepartmentdetails.cs
字號(hào):
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO ;
namespace BlueHill.BlueHillWindows.DepartmentManagement
{
/// <summary>
/// FromDepartmentDetails 的摘要說明。
/// </summary>
public class FromDepartmentDetails : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox txtEmail;
private System.Windows.Forms.TextBox txtLoginName;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.Label txtEmailLb;
private System.Windows.Forms.Label txtLoginNameLb;
private System.Windows.Forms.Label txtNameLb;
private System.Windows.Forms.PictureBox EmployeePic;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DataGrid grdEmployee;
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
private System.ComponentModel.Container components = null;
private string deptName;
DepartDetail dept = null;
public FromDepartmentDetails(string nodetext)
{
//
// Windows 窗體設(shè)計(jì)器支持所必需的
//
InitializeComponent();
deptName=nodetext;
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.btnOK = new System.Windows.Forms.Button();
this.grdEmployee = new System.Windows.Forms.DataGrid();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.txtEmail = new System.Windows.Forms.TextBox();
this.txtLoginName = new System.Windows.Forms.TextBox();
this.txtName = new System.Windows.Forms.TextBox();
this.txtEmailLb = new System.Windows.Forms.Label();
this.txtLoginNameLb = new System.Windows.Forms.Label();
this.txtNameLb = new System.Windows.Forms.Label();
this.EmployeePic = new System.Windows.Forms.PictureBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.grdEmployee)).BeginInit();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(288, 400);
this.btnOK.Name = "btnOK";
this.btnOK.TabIndex = 7;
this.btnOK.Text = "確定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// grdEmployee
//
this.grdEmployee.DataMember = "";
this.grdEmployee.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.grdEmployee.Location = new System.Drawing.Point(16, 264);
this.grdEmployee.Name = "grdEmployee";
this.grdEmployee.Size = new System.Drawing.Size(376, 120);
this.grdEmployee.TabIndex = 6;
this.grdEmployee.CurrentCellChanged += new System.EventHandler(this.grdEmployee_CurrentCellChanged);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.txtEmail);
this.groupBox2.Controls.Add(this.txtLoginName);
this.groupBox2.Controls.Add(this.txtName);
this.groupBox2.Controls.Add(this.txtEmailLb);
this.groupBox2.Controls.Add(this.txtLoginNameLb);
this.groupBox2.Controls.Add(this.txtNameLb);
this.groupBox2.Controls.Add(this.EmployeePic);
this.groupBox2.Location = new System.Drawing.Point(16, 112);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(368, 144);
this.groupBox2.TabIndex = 5;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "員工";
//
// txtEmail
//
this.txtEmail.Location = new System.Drawing.Point(240, 104);
this.txtEmail.Name = "txtEmail";
this.txtEmail.ReadOnly = true;
this.txtEmail.Size = new System.Drawing.Size(120, 21);
this.txtEmail.TabIndex = 6;
this.txtEmail.Text = "";
//
// txtLoginName
//
this.txtLoginName.Location = new System.Drawing.Point(240, 72);
this.txtLoginName.Name = "txtLoginName";
this.txtLoginName.ReadOnly = true;
this.txtLoginName.Size = new System.Drawing.Size(120, 21);
this.txtLoginName.TabIndex = 5;
this.txtLoginName.Text = "";
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(240, 40);
this.txtName.Name = "txtName";
this.txtName.ReadOnly = true;
this.txtName.Size = new System.Drawing.Size(120, 21);
this.txtName.TabIndex = 4;
this.txtName.Text = "";
//
// txtEmailLb
//
this.txtEmailLb.Location = new System.Drawing.Point(168, 104);
this.txtEmailLb.Name = "txtEmailLb";
this.txtEmailLb.Size = new System.Drawing.Size(56, 16);
this.txtEmailLb.TabIndex = 3;
this.txtEmailLb.Text = "電子郵件";
this.txtEmailLb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// txtLoginNameLb
//
this.txtLoginNameLb.Location = new System.Drawing.Point(168, 72);
this.txtLoginNameLb.Name = "txtLoginNameLb";
this.txtLoginNameLb.Size = new System.Drawing.Size(56, 16);
this.txtLoginNameLb.TabIndex = 2;
this.txtLoginNameLb.Text = "登錄名";
this.txtLoginNameLb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// txtNameLb
//
this.txtNameLb.Location = new System.Drawing.Point(168, 40);
this.txtNameLb.Name = "txtNameLb";
this.txtNameLb.Size = new System.Drawing.Size(56, 16);
this.txtNameLb.TabIndex = 1;
this.txtNameLb.Text = "姓名";
this.txtNameLb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// EmployeePic
//
this.EmployeePic.Location = new System.Drawing.Point(16, 24);
this.EmployeePic.Name = "EmployeePic";
this.EmployeePic.Size = new System.Drawing.Size(112, 112);
this.EmployeePic.TabIndex = 0;
this.EmployeePic.TabStop = false;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(16, 16);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(312, 80);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "部門";
//
// label2
//
this.label2.Location = new System.Drawing.Point(168, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(120, 32);
this.label2.TabIndex = 1;
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 32);
this.label1.TabIndex = 0;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// FromDepartmentDetails
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(408, 429);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.grdEmployee);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "FromDepartmentDetails";
this.Text = "部門明細(xì)";
this.Load += new System.EventHandler(this.FromDepartmentDetails_Load);
((System.ComponentModel.ISupportInitialize)(this.grdEmployee)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void btnOK_Click(object sender, System.EventArgs e)
{
this.Close ();
}
private void FromDepartmentDetails_Load(object sender, System.EventArgs e)
{
this.label1.Text=deptName;
dept = new DepartDetail();
dept.deptname=this.label1.Text;
this.grdEmployee.DataSource = dept.displayemployee().Tables[0];
this.label2.Text = dept.ds.Tables[0].Rows.Count.ToString()+"人";
}
private void grdEmployee_CurrentCellChanged(object sender, System.EventArgs e)
{
this.txtName.Text=dept.ds.Tables[0].Rows[this.grdEmployee.CurrentRowIndex] ["Name"].ToString();
this.txtLoginName .Text=dept.ds.Tables[0].Rows[this.grdEmployee.CurrentRowIndex] ["LoginName"].ToString();
this.txtEmail.Text=dept.ds.Tables[0].Rows[this.grdEmployee.CurrentRowIndex] ["Email"].ToString();
//this.empicture.Image=dept.ds.Tables[0].Rows[this.grdEmployee.CurrentRowIndex] ["PhotoImage"];
if (!(grdEmployee[grdEmployee.CurrentRowIndex,13] is Byte[]))
{
MessageBox.Show("沒有此員工的照片!");
}
else
{
byte[] imgb=(byte[])grdEmployee[grdEmployee.CurrentRowIndex,13];
MemoryStream ms=new MemoryStream(imgb);
EmployeePic.Image=Image.FromStream(ms);
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -