实现打印机

Font a=new Font("Tahoma",11,FontStyle.Regular);
Brush s=Brushes.Black;
Pen d=new Pen(s);

d.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.DrawLine(d,nleft,ntop,nleft+nwidth,ntop);
e.Graphics.DrawLine(d,nleft,ntop+nheight,nleft+nwidth,ntop);
e.Graphics.DrawLine(d,nleft,ntop,nleft,nleft+nheight);
e.Graphics.DrawLine(d,nleft+nwidth,ntop,nleft+nwidth,ntop+nheight);


e.Graphics.DrawString("订单细目数据",new Font("Garamons",40),s,nleft+30,ntop+10);
e.Graphics.DrawString("订单细目编号",a,s,nleft+20,ntop+60);
e.Graphics.DrawString("订单编号",a,s,nleft+140,ntop+60);
e.Graphics.DrawString("产品编号",a,s,nleft+260,ntop+60);
e.Graphics.DrawString("数量",a,s,nleft+340,ntop+60);
e.Graphics.DrawString("单价",a,s,nleft+420,ntop+60);
e.Graphics.DrawString("总价",a,s,nleft+520,ntop+60);


e.Graphics.DrawString(this.textBox1.Text,a,s,nleft+20,ntop+30);
e.Graphics.DrawString(this.textBox2.Text,a,s,nleft+140,ntop+30);
e.Graphics.DrawString(this.textBox3.Text,a,s,nleft+260,ntop+30);
e.Graphics.DrawString(this.textBox4.Text,a,s,nleft+340,ntop+30);
e.Graphics.DrawString(this.textBox5.Text,a,s,nleft+420,ntop+30);
e.Graphics.DrawString (this.textBox6.Text,a,s,nleft+520,ntop+30);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值