using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing.Imaging; using System.Drawing.Printing; using System.Windows.Forms; using SteamWare; using GMW_data; using System.Drawing; namespace GMW_data { /// /// Classe che si occupa di stampare etichette barcode via printer remota /// public class bCodePrinter { /// /// funzione di stampa... /// public void Print(string printerName, PaperSize pSize, string testo, string bCode, float EmSize ) { text2print = testo; bCode2print = bCode; baseEmSize = EmSize; PrintDocument label = new PrintDocument(); label.DefaultPageSettings.PaperSize = pSize; label.PrinterSettings.PrinterName = printerName; label.PrinterSettings.DefaultPageSettings.PaperSize = pSize; label.PrintPage += new PrintPageEventHandler(PrintPage); label.Print(); } public string text2print { get; set; } public string bCode2print { get; set; } public float baseEmSize { get; set; } private void PrintPage(object sender, PrintPageEventArgs e) { SolidBrush brush = new SolidBrush(Color.Black); Font arial = new Font("Arial", baseEmSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); Font threeOfNine = new Font("Free 3 of 9 Extended", baseEmSize* 3, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); e.Graphics.DrawString(text2print, arial, brush, 0, 5); e.Graphics.DrawString("*" + bCode2print + "*", threeOfNine, brush, 0, Convert.ToInt32(10 + baseEmSize)); e.Graphics.DrawString("*" + bCode2print + "*", threeOfNine, brush, 0, Convert.ToInt32(10 + baseEmSize * 2)); e.Graphics.DrawString("*" + bCode2print + "*", threeOfNine, brush, 0, Convert.ToInt32(10 + baseEmSize * 3)); } /// /// oggetto protected /// /// protected bCodePrinter() { #if false logLevel = memLayer.ML.confReadInt("_logLevel"); #endif } /// /// singleton pubblico /// public static bCodePrinter man = new bCodePrinter(); } }