private void PrintTask()
 {
     while (this.counter < this.stopCounter)
     {
         // StringBuilder msg = new StringBuilder();
         //int i = HotPrinterImporter.PrintLine(this.txtPrintContent.Text.Trim(), msg);
         //if (i == 0)
         //{
         TemplatePrintObject printer       = new TemplatePrintObject(config);
         CommonPrinter       commonPrinter = new CommonPrinter(printer);
         commonPrinter.SetPaperSize(config.PageWidth, config.PageHeight);
         commonPrinter.Print();
         counter++;
         //}
         this.setHint("正在打印:" + counter.ToString() + "页!");
         System.Threading.Thread.Sleep(this.threadSleepTime * 1000);
         if (this.counter == this.stopCounter)
         {
             this.setHint("打印完成:" + counter.ToString() + "页!");
             this.btnBeginPrint.Enabled = true;
             this.btnEndPrint.Enabled   = false;
             break;
         }
     }
 }
Exemple #2
0
        public void PrintView()
        {
            IPrinter printer = new TemplatePrintObject(config);

            CommonPrinter common = new CommonPrinter(printer);

            common.Preview();
        }
        private void btnPreview_Click(object sender, EventArgs e)
        {
            TemplatePrintObject printer       = new TemplatePrintObject(config);
            CommonPrinter       commonPrinter = new CommonPrinter(printer);

            commonPrinter.SetPaperSize(config.PageWidth, config.PageHeight);
            commonPrinter.Preview();
        }
Exemple #4
0
        public void PrintMargin(int left, int top, int right, int bottom)
        {
            IPrinter printer = new TemplatePrintObject(config);

            CommonPrinter common = new CommonPrinter(printer);

            common.SetPageSize(left, top, right, bottom);
            common.Print();
        }