Exemple #1
0
        public void Print()
        {
            int  numCustomers = 1;
            Font PrintFont    = new Font("Arial", 10);
            Font headFont     = new Font("Arial", 12, System.Drawing.FontStyle.Bold);

            PrintElement Header = new PrintElement(null);

            Header.AddMiddleText("Report", headFont);
            Header.AddHorizontalRule();

            PrintElement Footer = new PrintElement(null);

            Footer.AddHorizontalRule();
            Footer.AddMiddleText("Confidential", headFont);
            PrintEngine _engine = new PrintEngine(Header, Footer);

            for (int n = 0; n < numCustomers; n++)
            {
                Customer theCustomer = new Customer();
                theCustomer.Id        = n + 1;
                theCustomer.FirstName = "Darren";
                theCustomer.LastName  = "Clarke";
                theCustomer.Company   = "Madras inc.";
                theCustomer.Email     = "*****@*****.**";
                theCustomer.Phone     = "602 555 1234";

                _engine.AddPrintObject(theCustomer);
            }
            _engine.Print();
        }
Exemple #2
0
        public static void PrintTicket(PrintedBill pBill)
        {
            //pBill.Print()
            PrintEngine printEngine = new PrintEngine();

            printEngine.AddPrintObject(pBill);
            printEngine.Print();
        }
Exemple #3
0
 public static void PrintTicket(PrintedBill pBill)
 {
     //pBill.Print()
     try
     {
         PrintEngine printEngine = new PrintEngine();
         printEngine.AddPrintObject(pBill);
         printEngine.Print();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "打印", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void toolStripMenuItem2_Click(object sender, EventArgs e)
 {
     _printEngine.PrintableForm = this.ActiveMdiChild;
     _printEngine.Print();
 }