没有合适的资源?快使用搜索试试~ 我知道了~
条码打印源码
资源推荐
资源详情
资源评论
namespace FormExample
{
public partial class Form2 : Form
{
//Created by zhuhl on 2014-11-16
private int nPrintIdTmp;
private int LabelType;
private string LabelFile = string.Empty;
public Form2()
{
InitializeComponent();
}
private void btnPrint_Click(object sender, EventArgs e)
{
if (this.txtProlot.Text.Trim().Length > 15)
{
MessageBox.Show("批号长度不能超过15位","系统提示",MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
if (this.ChkProlot())
{
string strPath = Application.StartupPath.ToString();
string str2 = "";
str2 = strPath + @"\Label\FontLib.xml"; //设置字体
// string barFontlist = ;
PrintersAndPrintType type = new PrintersAndPrintType();
if (type.ShowDialog() != DialogResult.Cancel) // 取消选打印机及语言,直接取默认,即EPLII 和 默认打印机
{
public partial class Form2 : Form
{
//Created by zhuhl on 2014-11-16
private int nPrintIdTmp;
private int LabelType;
private string LabelFile = string.Empty;
public Form2()
{
InitializeComponent();
}
private void btnPrint_Click(object sender, EventArgs e)
{
if (this.txtProlot.Text.Trim().Length > 15)
{
MessageBox.Show("批号长度不能超过15位","系统提示",MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
if (this.ChkProlot())
{
string strPath = Application.StartupPath.ToString();
string str2 = "";
str2 = strPath + @"\Label\FontLib.xml"; //设置字体
// string barFontlist = ;
PrintersAndPrintType type = new PrintersAndPrintType();
if (type.ShowDialog() != DialogResult.Cancel) // 取消选打印机及语言,直接取默认,即EPLII 和 默认打印机
{
string strSql = "PRODUCT_GETBARCODEDATA '" + this.nPrintIdTmp + "','" + this.LabelType + "'";
ITPrintClass class2 = new ITPrintClass();
// class2.ChineseFontName = "宋体";
// class2.BeginPrint(); // 直接发送到默认打印机
class2.BeginPrintAt(type.ITPrinterName); //指定打印机
if (string.Compare(type.ITPrinterType, "ZPLII") == 0)
{
class2.PrinterType = tagITPrinterType.ZPLII;
}
if ((str2 != null) && (str2.Length > 0))
{
//获取定义标签的文件的内容
class2.LoadFontLibIndexFromText(this.GetDefineLabelXmlText(str2));
}
string strFile = strPath + @"\Label\" + LabelFile;//添加路径信息
class2.SetBarcodeDefineXmlText(this.GetDefineLabelXmlText(strFile)); //标贴定义档
if (strSql.Length > 0)
{
class2.PrintDefinedBarcodeLabel(this.GetSqlDataXmlText(strSql));//从数据库取的
}
else
{
class2.PrintDefinedBarcodeLabel(null);
}
class2.EndPrint();
string strSql = "PRODUCT_GETBARCODEDATA '" + this.nPrintIdTmp + "','" + this.LabelType + "'";
ITPrintClass class2 = new ITPrintClass();
// class2.ChineseFontName = "宋体";
// class2.BeginPrint(); // 直接发送到默认打印机
class2.BeginPrintAt(type.ITPrinterName); //指定打印机
if (string.Compare(type.ITPrinterType, "ZPLII") == 0)
{
class2.PrinterType = tagITPrinterType.ZPLII;
}
if ((str2 != null) && (str2.Length > 0))
{
//获取定义标签的文件的内容
class2.LoadFontLibIndexFromText(this.GetDefineLabelXmlText(str2));
}
string strFile = strPath + @"\Label\" + LabelFile;//添加路径信息
class2.SetBarcodeDefineXmlText(this.GetDefineLabelXmlText(strFile)); //标贴定义档
if (strSql.Length > 0)
{
class2.PrintDefinedBarcodeLabel(this.GetSqlDataXmlText(strSql));//从数据库取的
}
else
{
class2.PrintDefinedBarcodeLabel(null);
}
class2.EndPrint();
剩余5页未读,继续阅读
资源评论
qly0000
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功