| | |
| | | |
| | | |
| | | PrintDocument printDocument1 = new PrintDocument(); |
| | | int ttwith = (int)(80 * 4); |
| | | int ttheigh = (int)(40 * 4); |
| | | int ttwith = (int)(60 * 4); |
| | | int ttheigh = (int)(20 * 4); |
| | | string message = ""; |
| | | |
| | | public void StartPrint(string str) |
| | | { |
| | | try |
| | | { |
| | | ttwith = 320; |
| | | ttheigh = 160; |
| | | ttwith = 240; |
| | | ttheigh = 80; |
| | | message = str; |
| | | |
| | | if (string.IsNullOrEmpty(message)) |
| | |
| | | |
| | | this.printDocument1.PrintController = new System.Drawing.Printing.StandardPrintController(); |
| | | this.printDocument1.Print(); |
| | | |
| | | this.printDocument1.DefaultPageSettings.PrinterSettings.PrinterName = "Honeywell PX240S (300 dpi)1"; |
| | | this.printDocument1.DefaultPageSettings.PaperSize = new PaperSize("Custum", ttwith, ttheigh); |
| | | |
| | | this.printDocument1.PrintController = new System.Drawing.Printing.StandardPrintController(); |
| | | this.printDocument1.Print(); |
| | | |
| | | |
| | | |
| | | } |
| | | catch |
| | |
| | | |
| | | writer.Options = options; |
| | | Bitmap map = writer.Write(numvalue); |
| | | e.Graphics.DrawImage(map, new System.Drawing.Point(90,10)); |
| | | e.Graphics.DrawImage(map, new System.Drawing.Point(90,4)); |
| | | |
| | | |
| | | // 在二维码下方画内容文字 |
| | |
| | | // 让文字居中到二维码下方 |
| | | SizeF textSize = e.Graphics.MeasureString(numvalue, font); |
| | | float textX = 90 + (map.Width - textSize.Width) / 2; |
| | | float textY = 10 + map.Height; |
| | | float textY = 1 + map.Height; |
| | | |
| | | e.Graphics.DrawString(numvalue, font, brush3, textX, textY); |
| | | } |