예제 #1
0
        private void btnBarcode_Click(object sender, EventArgs e)
        {
            if (dgvMaster.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                DataTable barcodeTable = new ProductStateDal().GetBarcodes(masterRow["BILLNO"].ToString());
                BarcodePrinter printer = new BarcodePrinter();

                DialogResult dr = THOKUtil.ShowQuery2("ѡ����(Y)����ӡѡ����ⵥ��ѡ�񡰷�(N)����ӡѡ����ǩ��ѡ��ȡ������ִ�д�ӡ������");
                switch (dr)
                {
                    case DialogResult.Yes:
                        printer.Print(barcodeTable);

                        break;
                    case DialogResult.No:
                        if (dgvDetail.CurrentRow != null)
                        {
                            DataRow detailRow = ((DataRowView)dgvDetail.CurrentRow.DataBoundItem).Row;
                            printer.Print(barcodeTable, detailRow["BARCODE"].ToString());
                        }
                        break;

                }
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            // Prepare Barcode object that will generate barcodes for printing
            var barcode = new Barcode();

            barcode.RegistrationName = "demo";
            barcode.RegistrationKey  = "demo";
            barcode.Symbology        = SymbologyType.EAN13;
            barcode.DrawCaption      = true;
            barcode.BarHeight        = 50;
            barcode.DrawQuietZones   = false;
            barcode.Margins          = new Margins(20, 20, 20, 20);

            // Prepare BarcodePrinter object
            var barcodePrinter = new BarcodePrinter();

            // Set printer paper size
            barcodePrinter.SetPaperSize("A4");
            // Set number of barcodes on a page: 4 lines of 4 barcodes per line = 16 barcodes per page
            barcodePrinter.SetGrid(4, 4);
            // Fit barcodes into the grid cell size
            barcodePrinter.FitBarcodesIntoGrid = true;
            // Set some optional printing params
            //barcodePrinter.SetMargins(20, 0, 0, 20);
            //barcodePrinter.Copies = 2;
            //barcodePrinter.Collate = true;
            //barcodePrinter.Color = false;

            // Generate 25 barcode values in EAN13 format "5901234NNNNN"
            // and add them to the BarcodePrinter
            var barcodeValues = Enumerable.Range(1, 25).Select(n => "5901234" + n.ToString("00000")).ToList();

            barcodePrinter.AddBarcodeValues(barcodeValues);

            // Print barcodes to the specified printer
            barcodePrinter.Print(barcode, "Microsoft Print to PDF");
        }
예제 #3
0
 private void btnBarcode_Click(object sender, EventArgs e)
 {
     if (dgvMaster.CurrentRow != null)
     {
         DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
         DataTable barcodeTable = new ProductStateDal().GetBarcodes(masterRow["BILLNO"].ToString(), UserID);
         BarcodePrinter printer = new BarcodePrinter();
         printer.Print(barcodeTable);
     }
 }