110,534
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
printDocument.Print();
}
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
string cmd = "";
cmd = " " + "\r\n" +
"N" + "\r\n" +
"B10,10,0,3,3,7,100,B,\"123456\"" + "\r\n" +
"P1";
Font mainFont = new Font("Courier New", 8);
string strLine = String.Format("{0,0}", cmd);//Gb.printstr是全部的ZPL指令,我用的全局变量
e.Graphics.DrawString(strLine, mainFont, Brushes.Black, PointF.Empty);
}