Files
GMW/GMW_data/bCodePrinter.cs
T

56 lines
1.5 KiB
C#

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
{
/// <summary>
/// Classe che si occupa di stampare etichette barcode via printer remota
/// </summary>
public class bCodePrinter
{
/// <summary>
/// funzione di stampa...
/// </summary>
public void Print(string printerName, PaperSize pSize, string testo)
{
tex2print = testo;
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 tex2print { get; set; }
private void PrintPage(object sender, PrintPageEventArgs e)
{
SolidBrush brush = new SolidBrush(Color.Black);
Font threeOfNine = new Font("Free 3 of 9 Extended", 40, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
e.Graphics.DrawString("*" + tex2print + "*", threeOfNine, brush, 20, 20);
}
/// <summary>
/// oggetto protected
/// </summary>
/// <param name="args"></param>
protected bCodePrinter()
{
#if false
logLevel = memLayer.ML.confReadInt("_logLevel");
#endif
}
/// <summary>
/// singleton pubblico
/// </summary>
public static bCodePrinter man = new bCodePrinter();
}
}