c# winform 写的打印方法,调用惠普打印机没问题,热敏pos80小票机不行

「已注销」 2016-06-20 04:42:50
c# winform 写的打印方法,调用惠普打印机没问题,热敏pos80小票机不行.

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font font = new Font("宋体", 14);
Font fonttishi = new Font("宋体", 10);
Font fonthm = new Font("楷体", 30);
Font fonttitle = new Font("楷体", 20);
Brush bru = Brushes.Black;
string strname = label1.Text + textBox1.Text;
string strphone = textBox2.Text;
string strqian = strphone.Substring(0, 4);
string strhou = strphone.Substring(strphone.Length - 2);
string strqihou = strqian + "*****" + strhou;
string strhm = textBox3.Text + "号";
string strtime = DateTime.Now.ToShortDateString().ToString();
string strtujing = label11.Text;
string strdoc = comboBox1.Text;

StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;

e.Graphics.DrawString("中医馆", fonttitle, bru, new Rectangle(2, 5, 200, 180),sf);
e.Graphics.DrawString(strhm, fonthm, bru, new Rectangle(2, 45, 350, 180), sf);
e.Graphics.DrawString(strname, font, bru, new Rectangle(2, 120, 700, 200)); // ("x","y","

宽度","高度")
e.Graphics.DrawString("手机:" + strqihou, font, bru, new Rectangle(2, 150, 700, 200));
e.Graphics.DrawString("医生:" + strdoc, font, bru, new Rectangle(2, 180, 700, 200));
e.Graphics.DrawString("日期:" + strtime, font, bru, new Rectangle(2, 210, 700, 200));
e.Graphics.DrawString("途径:" + strtujing, font, bru, new Rectangle(2, 240, 700, 200));
e.Graphics.DrawString("公众号:xxxxxx 可在线挂号", fonttishi, bru, new Rectangle(2, 270,

700, 200));


}
public void Print()
{
this.pageSetupDialog1.ShowDialog(); //打印设置
this.printPreviewDialog1.ShowDialog(); //打印预览
this.printDocument1.Print(); //打印

}
用的这种方法打印小票,测试的时候用的惠普打印机,没问题,能打出来,当在别的电脑上面用热敏的pos80打印的

时候
就没反应。求助,这是为什么。
...全文
402 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
homesos 2016-06-20
  • 打赏
  • 举报
回复
引用 2 楼 pppooo138 的回复:
[quote=引用 1 楼 homesos 的回复:] 直接用个报表控件多好,即方便扩展性又好,比如fastreport。
fastreport 能打印热敏的的pos80吗[/quote] 只要操作系统认的是打印机设备就可以,你可以下载个fastreport,用它的工具做张报表试一下。
我叫小菜菜 2016-06-20
  • 打赏
  • 举报
回复
热敏小票,那是小票,巴掌大的,典型的打印纸宽 80mm 有效打印宽度 72mm new Rectangle(2, 150, 700, 200) 这250,700,200是啥? A4打印机和热敏小票打印机,是完全不同的,不能混淆。
「已注销」 2016-06-20
  • 打赏
  • 举报
回复
引用 1 楼 homesos 的回复:
直接用个报表控件多好,即方便扩展性又好,比如fastreport。
fastreport 能打印热敏的的pos80吗
homesos 2016-06-20
  • 打赏
  • 举报
回复
直接用个报表控件多好,即方便扩展性又好,比如fastreport。

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧