Ejemplo n.º 1
0
        // Barcode 2D

        private void printQRCodeCmdButton_Click(object sender, EventArgs e)
        {
            // TODO: Add your control notification handler code here
            long   lResult;
            string strQRCodeLeft   = "QRCode Test Left Alignment";
            string strQRCodeCenter = "QRCode Test Center Alignment";
            string strQRCodeRight  = "QRCode Test Right Alignment";

            if (useprinterdriver)
            {
                m_strPrinter = pDriverNameTextBox.Text.ToString();
                lResult      = LKPrint.OpenPort(m_strPrinter, 1);
                if (lResult != 0)
                {
                    MessageBox.Show("OpenPrinter Failed", "Error", MessageBoxButtons.OK);
                    return;
                }
            }

            LKPrint.PrintStart();

            LKPrint.PrintQRCode(strQRCodeLeft, 0, 3, 0, LKPrint.LK_ALIGNMENT_LEFT);
            LKPrint.PrintQRCode(strQRCodeCenter, 0, 3, 0, LKPrint.LK_ALIGNMENT_CENTER);
            LKPrint.PrintQRCode(strQRCodeRight, 0, 3, 0, LKPrint.LK_ALIGNMENT_RIGHT);

            LKPrint.PrintBarCode("1234567890", 109, 40, 512, 1, 2); // POSPrinter
            LKPrint.PrintNormal("\x1b|fP");

            LKPrint.PrintStop();

            if (useprinterdriver)
            {
                lResult = LKPrint.ClosePort();
                if (lResult != 0)
                {
                    MessageBox.Show("ClosePrinter Failed!!!", "Error", MessageBoxButtons.OK);
                }
            }
        }