C# 霍尼韦尔扫码枪扫码打印

该博客介绍了如何在C#环境下使用DevExpress BarCodeControl控件配合霍尼韦尔扫码枪实现条码扫描并即时打印。首先将扫码枪设置为串口模式,然后通过Virtual Serial Port Driver创建虚拟串口,当接收到扫码数据后,将条码显示在BarMa控件中,并调用打印方法生成条码图像并打印。整个流程涉及WinForm窗体事件处理、串口监听和位图复制到打印机的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

程序运行背景条件:

1、将扫码枪调制串口驱动模式

2、将扫码枪所在串口拆分成几个虚拟串口

3、扫码枪扫描条码就打印条码

4、WinForm程序

条码控件使用 DevExpress.XtraEditors.BarCodeControl   控件 BarMa

 

 BarMa 控件加载时将文本居中

BarMa.VerticalAlignment = DevExpress.Utils.VertAlignment.Center;
BarMa.HorizontalAlignment = DevExpress.Utils.HorzAlignment.Near;
BarMa.HorizontalTextAlignment = DevExpress.Utils.HorzAlignment.Center;
BarMa.VerticalTextAlignment = DevExpress.Utils.VertAlignment.Center;

BarMa 添加事件

BarMa.TextChanged += BarMa_TextChanged;
BarMa.Paint += BarMa_Paint;

 

为窗体添加printPreviewDialog和printDocument控件

printPreview

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值