基本信息
源码名称:c#实现BarTender二次开发示例
源码大小:0.20M
文件格式:.rar
开发语言:C#
更新时间:2021-08-12
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
核心代码:
btFormat = btAPP.Formats.Open(System.Windows.Forms.Application.StartupPath @"\1.btw", false, "");
btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;//打印份数
btFormat.PrintSetup.NumberSerializedLabels = 1;//序列标签数
btFormat.SetNamedSubStringValue("打印文本", txtMemo.Text.Trim());
btFormat.SetNamedSubStringValue("打印条码", txtBarcode.Text.Trim());
btFormat.PrintOut(true, true);//第二个false设置打印时是否跳出打印属性
btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges); //退出时是否保存标签
二、基本原理:
1、先设计好Btw模板
2、代码调用模板去打印
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace BarTenderDemo
{
public partial class Form1 : Form
{
private BarTender.Application btAPP;
private BarTender.Format btFormat;
//SELECT MaterielId,ProductBigPackId,NetWeight,GrossWeight,num
//FROM Make_ProductBigPack mpb
//LEFT JOIN Make_TaskInfo mti ON mpb.TaskId=mti.TaskId
//WHERE ProductBigPackId=''
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
btAPP = new BarTender.Application();
}
private void btPrint_Click(object sender, EventArgs e)
{
try
{
btFormat = btAPP.Formats.Open(System.Windows.Forms.Application.StartupPath @"\1.btw", false, "");
btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;//打印份数
btFormat.PrintSetup.NumberSerializedLabels = 1;//序列标签数
btFormat.SetNamedSubStringValue("打印文本", txtMemo.Text.Trim());
btFormat.SetNamedSubStringValue("打印条码", txtBarcode.Text.Trim());
btFormat.PrintOut(true, true);//第二个false设置打印时是否跳出打印属性
btFormat.Close(BarTender.BtSaveOptions.btSaveChanges); //退出时是否保存标签
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
btAPP.Quit(BarTender.BtSaveOptions.btSaveChanges);//界面退出时同步退出bartender进程
}
}
}
核心代码:
btFormat = btAPP.Formats.Open(System.Windows.Forms.Application.StartupPath @"\1.btw", false, "");
btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;//打印份数
btFormat.PrintSetup.NumberSerializedLabels = 1;//序列标签数
btFormat.SetNamedSubStringValue("打印文本", txtMemo.Text.Trim());
btFormat.SetNamedSubStringValue("打印条码", txtBarcode.Text.Trim());
btFormat.PrintOut(true, true);//第二个false设置打印时是否跳出打印属性
btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges); //退出时是否保存标签
二、基本原理:
1、先设计好Btw模板
2、代码调用模板去打印
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace BarTenderDemo
{
public partial class Form1 : Form
{
private BarTender.Application btAPP;
private BarTender.Format btFormat;
//SELECT MaterielId,ProductBigPackId,NetWeight,GrossWeight,num
//FROM Make_ProductBigPack mpb
//LEFT JOIN Make_TaskInfo mti ON mpb.TaskId=mti.TaskId
//WHERE ProductBigPackId=''
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
btAPP = new BarTender.Application();
}
private void btPrint_Click(object sender, EventArgs e)
{
try
{
btFormat = btAPP.Formats.Open(System.Windows.Forms.Application.StartupPath @"\1.btw", false, "");
btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;//打印份数
btFormat.PrintSetup.NumberSerializedLabels = 1;//序列标签数
btFormat.SetNamedSubStringValue("打印文本", txtMemo.Text.Trim());
btFormat.SetNamedSubStringValue("打印条码", txtBarcode.Text.Trim());
btFormat.PrintOut(true, true);//第二个false设置打印时是否跳出打印属性
btFormat.Close(BarTender.BtSaveOptions.btSaveChanges); //退出时是否保存标签
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
btAPP.Quit(BarTender.BtSaveOptions.btSaveChanges);//界面退出时同步退出bartender进程
}
}
}