📄 frmcompanymes.cs
字号:
this.textBoxX3.Border.Class = "TextBoxBorder";
this.textBoxX3.Enabled = false;
this.textBoxX3.Location = new System.Drawing.Point(287, 60);
this.textBoxX3.Name = "textBoxX3";
this.textBoxX3.Size = new System.Drawing.Size(124, 21);
this.textBoxX3.TabIndex = 14;
//
// textBoxX2
//
this.textBoxX2.AutoSize = false;
//
// textBoxX2.Border
//
this.textBoxX2.Border.Class = "TextBoxBorder";
this.textBoxX2.Enabled = false;
this.textBoxX2.Location = new System.Drawing.Point(87, 60);
this.textBoxX2.Name = "textBoxX2";
this.textBoxX2.Size = new System.Drawing.Size(124, 21);
this.textBoxX2.TabIndex = 13;
//
// textBoxX1
//
this.textBoxX1.AutoSize = false;
//
// textBoxX1.Border
//
this.textBoxX1.Border.Class = "TextBoxBorder";
this.textBoxX1.Enabled = false;
this.textBoxX1.Location = new System.Drawing.Point(87, 12);
this.textBoxX1.Name = "textBoxX1";
this.textBoxX1.Size = new System.Drawing.Size(248, 21);
this.textBoxX1.TabIndex = 12;
//
// labelX3
//
this.labelX3.BackColor = System.Drawing.Color.Transparent;
this.labelX3.ForeColor = System.Drawing.Color.Black;
this.labelX3.Location = new System.Drawing.Point(231, 60);
this.labelX3.Name = "labelX3";
this.labelX3.Size = new System.Drawing.Size(72, 24);
this.labelX3.TabIndex = 11;
this.labelX3.Text = "电话:";
//
// labelX2
//
this.labelX2.BackColor = System.Drawing.Color.Transparent;
this.labelX2.ForeColor = System.Drawing.Color.Black;
this.labelX2.Location = new System.Drawing.Point(15, 60);
this.labelX2.Name = "labelX2";
this.labelX2.Size = new System.Drawing.Size(88, 24);
this.labelX2.TabIndex = 10;
this.labelX2.Text = "Email:";
//
// labelX5
//
this.labelX5.BackColor = System.Drawing.Color.Transparent;
this.labelX5.ForeColor = System.Drawing.Color.Black;
this.labelX5.Location = new System.Drawing.Point(15, 12);
this.labelX5.Name = "labelX5";
this.labelX5.Size = new System.Drawing.Size(88, 24);
this.labelX5.TabIndex = 9;
this.labelX5.Text = "公司名称:";
//
// labelX1
//
this.labelX1.Location = new System.Drawing.Point(56, 32);
this.labelX1.Name = "labelX1";
this.labelX1.TabIndex = 0;
this.labelX1.Text = "labelX1";
//
// buttonX2
//
this.buttonX2.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonX2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.buttonX2.ForeColor = System.Drawing.Color.Black;
this.buttonX2.Image = ((System.Drawing.Image)(resources.GetObject("buttonX2.Image")));
this.buttonX2.Location = new System.Drawing.Point(160, 0);
this.buttonX2.Name = "buttonX2";
this.buttonX2.Size = new System.Drawing.Size(128, 32);
this.buttonX2.TabIndex = 2;
this.buttonX2.Text = "<b>员工资料</b>";
this.buttonX2.Click += new System.EventHandler(this.buttonX2_Click);
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(30, 30);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.AliceBlue;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Controls.Add(this.buttonX2);
this.panel1.Location = new System.Drawing.Point(0, 280);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(448, 40);
this.panel1.TabIndex = 3;
//
// printDocument1
//
this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
//
// pageSetupDialog1
//
this.pageSetupDialog1.Document = this.printDocument1;
//
// printPreviewDialog1
//
this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
this.printPreviewDialog1.Document = this.printDocument1;
this.printPreviewDialog1.Enabled = true;
this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
this.printPreviewDialog1.Location = new System.Drawing.Point(133, 23);
this.printPreviewDialog1.MinimumSize = new System.Drawing.Size(375, 250);
this.printPreviewDialog1.Name = "printPreviewDialog1";
this.printPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty;
this.printPreviewDialog1.Visible = false;
//
// frmCompanyMes
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(450, 322);
this.Controls.Add(this.groupPanel1);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmCompanyMes";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "公司基本数据";
this.Load += new System.EventHandler(this.frmCompanyMes_Load);
this.groupPanel1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
//员工资料
private void buttonX2_Click(object sender, System.EventArgs e)
{
frmEmployees fe=new frmEmployees();
fe.Show();
}
private void frmCompanyMes_Load(object sender, System.EventArgs e)
{
this._ds=this._CompanyMessageBS.select();
foreach(DataRow row in this._ds.Tables[0].Rows)
{
//公司名称
this.textBoxX1.Text=row[0].ToString();
//Email
this.textBoxX2.Text=row[2].ToString();
//电话
this.textBoxX3.Text=row[3].ToString();
//地址
this.textBoxX4.Text=row[1].ToString();
//法人代表
this.textBoxX5.Text=row[5].ToString();
//网址
this.textBoxX6.Text=row[4].ToString();
}
}
private void buttonX1_Click(object sender, System.EventArgs e)
{
this.printPreviewDialog1.ShowDialog();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font objFont = new Font("Tahoma",11,FontStyle.Underline);
Brush objBrush = Brushes.Black;
Pen objPen = new Pen(objBrush);
objPen.Width = 2;
//向打印预缆窗口中添加内容
int nLeft = this.pageSetupDialog1.PageSettings.Margins.Left;
int nTop = this.pageSetupDialog1.PageSettings.Margins.Top;
int nWidth = this.pageSetupDialog1.PageSettings.PaperSize.Width-
(this.pageSetupDialog1.PageSettings.Margins.Left +
this.pageSetupDialog1.PageSettings.Margins.Right);
int nHeight = this.pageSetupDialog1.PageSettings.PaperSize.Height-
(this.pageSetupDialog1.PageSettings.Margins.Top +
this.pageSetupDialog1.PageSettings.Margins.Bottom);
//打印出表头
e.Graphics.DrawString("公司信息",new Font("Garamond",40,FontStyle.Bold),Brushes.Blue,nLeft+200,nTop+10);
e.Graphics.DrawString("公司名称",objFont,objBrush,nLeft+10,nTop+60);
e.Graphics.DrawString("公司地址",objFont,objBrush,nLeft+100,nTop+60);
e.Graphics.DrawString("公司Email",objFont,objBrush,nLeft+180,nTop+60);
e.Graphics.DrawString("公司电话",objFont,objBrush,nLeft+300,nTop+60);
e.Graphics.DrawString("公司网址",objFont,objBrush,nLeft+420,nTop+60);
e.Graphics.DrawString("员工法人",objFont,objBrush,nLeft+570,nTop+60);
e.Graphics.DrawString("公司传真",objFont,objBrush,nLeft+620,nTop+60);
e.Graphics.DrawString("员工人数",objFont,objBrush,nLeft+680,nTop+60);
e.Graphics.DrawString("员工备注",objFont,objBrush,nLeft+700,nTop+60);
//打印具体数据
try
{
this._ds=this._CompanyMessageBS.select();
int nLine=1;
foreach( DataRow rows in this._ds.Tables[0].Rows)
{
e.Graphics.DrawString(rows[0].ToString(),objFont,objBrush,nLeft+10,nTop+60+nLine*30);
e.Graphics.DrawString(rows[1].ToString(),objFont,objBrush,nLeft+100,nTop+60+nLine*30);
e.Graphics.DrawString(rows[2].ToString(),objFont,objBrush,nLeft+180,nTop+60+nLine*30);
e.Graphics.DrawString(rows[3].ToString(),objFont,objBrush,nLeft+300,nTop+60+nLine*30);
e.Graphics.DrawString(rows[4].ToString(),objFont,objBrush,nLeft+420,nTop+60+nLine*30);
e.Graphics.DrawString(rows[5].ToString(),objFont,objBrush,nLeft+570,nTop+60+nLine*30);
e.Graphics.DrawString(rows[6].ToString(),objFont,objBrush,nLeft+620,nTop+60+nLine*30);
e.Graphics.DrawString(rows[7].ToString(),objFont,objBrush,nLeft+680,nTop+60+nLine*30);
e.Graphics.DrawString(rows[8].ToString(),objFont,objBrush,nLeft+700,nTop+60+nLine*30);
nLine++;
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -