**## BarTender 标签打印
工业型条码机
lock (engine)
{
bool success = true;
// Assign number of identical copies if it is not datasourced.
if (format.PrintSetup.SupportsIdenticalCopies)
{
int copies = 1;
success = Int32.TryParse(txtIdenticalCopies.Text, out copies) && (copies >= 1);
if (!success)
MessageBox.Show(this, "Identical Copies must be an integer greater than or equal to 1.", appName);
else
{
format.PrintSetup.IdenticalCopiesOfLabel = copies;
}
}
// Assign number of serialized copies if it is not datasourced.
if (success && (format.PrintSetup.SupportsSerializedLabels))
{
int copies = 1;
success = Int32.TryParse(txtSerializedCopies.Text, out copies) && (copies >= 1);
if (!success)
{
MessageBox.Show(this, "Serialized Copies must be an integer greater than or equal to 1.", appName);
}
else
{
format.PrintSetup.NumberOfSerializedLabels = copies;
}
}
// If there are no incorrect values in the copies boxes then print.
if (success)
{
Cursor.Current = Cursors.WaitCursor;
// Get the printer from the dropdown and assign it to the format.
if (cboPrinters.SelectedItem != null)
format.PrintSetup.PrinterName = cboPrinters.SelectedItem.ToString();
Messages messages;
int waitForCompletionTimeout = 10000; // 10 seconds
Result result = format.Print(appName, waitForCompletionTimeout, out messages);
string messageString = "\n\nMessages:";
foreach (Seagull.BarTender.Print.Message message in messages)
{
messageString += "\n\n" + message.Text;
}
if (result == Result.Failure)
MessageBox.Show(this, "Print Failed" + messageString, appName);
else
MessageBox.Show(this, "Label was successfully sent to printer." + messageString, appName);
}
}
各种 各种打印机。斑马 佐腾 其它
可以根据 条码来设置 匹配码,匹配码再去排定模版。这样就可以扫码自动选择模版来打印标签了。