场景

Winform中使用zxing和Graphics实现自定义绘制二维码布局:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100127885

https://www.cnblogs.com/badaoliumangqizhi/p/11426919.html

在上面实现将二维码显示在pictureBox之中之后,将其打印。

效果

实现

页面拖拽一个printDocument控件。

拖拽之后的效果

然后再拖拽一个Button按钮,双击进入其点击事件中

private void button7_Click(object sender, EventArgs e)
{
PrintDialog MyPrintDg = new PrintDialog();
MyPrintDg.Document = printDocument1;
if (MyPrintDg.ShowDialog() == DialogResult.OK)
{
try
{
printDocument1.Print();
}
catch
{ //停止打印
printDocument1.PrintController.OnEndPrint(printDocument1, new System.Drawing.Printing.PrintEventArgs());
}
}
}

找到页面设计器中拖拽的printDocument控件上,右击属性,找到事件列表,然后双击其PrintPage事件

编写如下代码:

private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(pictureBox1.Image, , );
}

运行效果

最新文章

  1. android 滚动的缓冲图片
  2. osgi 2
  3. CF 370B Berland Bingo
  4. Xcode中设置按钮在十分钟之内禁用
  5. windows内核窥探
  6. 【转】NPAPI 插件无法在 Chrome 42 版及更高版本上正常运行
  7. tomcat内存溢出之PermGen space
  8. 用Codility测试你的编码能力
  9. 【一天一道LeetCode】#17. Letter Combinations of a Phone Number
  10. Swift 设置某个对象的normal 属性找不到normal 解决方案
  11. cvLogPolar函数详解
  12. js如何将选中图片文件转换成Base64字符串?
  13. 手机布局rem的使用(rem)
  14. TF-IDF词项权重计算
  15. easyui 中iframe嵌套页面,提示弹窗遮罩的解决方法,parent.$.messager.alert和parent.$.messager.confirm
  16. oracle数据库每天自动备份
  17. linux percpu机制解析【转】
  18. HDU 多校1.5
  19. 装饰器(Decorator)模式
  20. 物理的alpha blend

热门文章

  1. NLP(十五)让模型来告诉你文本中的时间
  2. 02、安装Linux系统
  3. 史上最全面 Android逆向培训之__Xposed使用
  4. 存在于文件名中的SQL手工注入
  5. 微信小程序项目总结-记账小程序(包括后端)
  6. ggplot2 |legend参数设置,图形精雕细琢
  7. OpenResty 社区王院生:APISIX 的高性能实践
  8. 如何使用WorkManager执行后台任务(下)
  9. 浅谈UART/12C/TTL的定义与区别与解析
  10. 记一次找回win7密码