程序运行背景条件:
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