The namespace WinFormTest
{
Public partial class Form1: Form
{
BarTender. Application btapp;
BarTender. Format btformat;
Public _click ()
{
InitializeComponent();
}
Private void Form1_Load (object sender, EventArgs e)
{
Try
{
Btapp=new BarTender. Application ();
Btformat=btapp. Formats. Open (@ "D: \ Users \ amaris ma \ Desktop \ opp/opp/G05_TRAY2 BTW", false, "");
}
The catch (Exception ex)
{
MessageBox. Show (" load BarTender instance failure!" );
}
}
Private void button1_Click (object sender, EventArgs e)
{
Btformat. PrintSetup. NumberSerializedLabels=1;//set copies
Btformat. SetNamedSubStringValue (" SN ", "123233");
Btformat. PrintOut (true, false);//the second parameter Settings are out of print properties;
Oook MessageBox. Show (" ");
}
Private void Form1_FormClosing (object sender, FormClosingEventArgs e)
{
Btformat. Close (BarTender. BtSaveOptions. BtDoNotSaveChanges);//exits whether save the tag
Btapp. Quit (BarTender. BtSaveOptions. BtSaveChanges);//exits with refund to exit the BarTender process
}
}
}
CodePudding user response:
Problems have been found, I put the wrong position code