Example #1
0
        private void DesignLabel(LabelDesign design)
        {
            design.DrawTextPtrFont("Sample Print", LabelConst.CLS_LOCALE_JP, LabelConst.CLS_PRT_FNT_TRIUMVIRATE_B, LabelConst.CLS_RT_NORMAL, 1, 1, LabelConst.CLS_PRT_FNT_SIZE_24, 20, 300);

            design.DrawQRCode("DrawQRCode", LabelConst.CLS_ENC_CDPG_IBM850, LabelConst.CLS_RT_NORMAL, 4, LabelConst.CLS_QRCODE_EC_LEVEL_H, 20, 220);

            design.FillRect(20, 150, 350, 40, LabelConst.CLS_SHADED_PTN_11);

            design.DrawBarCode("0123456789", LabelConst.CLS_BCS_CODE128, LabelConst.CLS_RT_NORMAL, 3, 3, 30, 20, 70, LabelConst.CLS_BCS_TEXT_SHOW);
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            // Create an instance( LabelDesign class )
            LabelDesign design = new LabelDesign();

            // Text
            design.DrawTextPtrFont("Sample Print", LabelConst.CLS_LOCALE_JP, LabelConst.CLS_PRT_FNT_TRIUMVIRATE_B, LabelConst.CLS_RT_NORMAL, 1, 1, LabelConst.CLS_PRT_FNT_SIZE_24, 20, 300);

            // QRCode
            design.DrawQRCode("DrawQRCode", LabelConst.CLS_ENC_CDPG_IBM850, LabelConst.CLS_RT_NORMAL, 4, LabelConst.CLS_QRCODE_EC_LEVEL_H, 20, 220);

            // Rect(fill)
            design.FillRect(20, 150, 350, 40, LabelConst.CLS_SHADED_PTN_11);

            // BarCode
            design.DrawBarCode("0123456789", LabelConst.CLS_BCS_CODE128, LabelConst.CLS_RT_NORMAL, 3, 3, 30, 20, 70, LabelConst.CLS_BCS_TEXT_SHOW);


            // Create an instance( LabelPrinter class )
            LabelPrinter printer = new LabelPrinter();

            // Get Type
            int type = (int)comboBox1.SelectedValue;

            // Get Address
            String addr = txt_Address.Text;

            // Set COMM Properties( COMM only )
            if (LabelConst.CLS_PORT_COM == type)
            {
                printer.SetCommProperties(LabelConst.CLS_COM_BAUDRATE_9600, LabelConst.CLS_COM_PARITY_NONE, LabelConst.CLS_COM_HANDSHAKE_DTRDSR);
            }
            int result = printer.Connect(type, addr);

            if (LabelConst.CLS_SUCCESS == result)
            {
                int printDarkness = printer.GetPrintDarkness();
                if (LabelConst.CLS_PROPERTY_DEFAULT == printDarkness)
                {
                    printer.SetPrintDarkness(10);
                }
                result = printer.Print(design, 0001);//
                if (LabelConst.CLS_SUCCESS != result)
                {
                    MessageBox.Show("Print Error : " + result.ToString(), "Citizen_Label_sample", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                printer.Disconnect();
            }
            else
            {
                MessageBox.Show("Connect Error : " + result.ToString(), "Citizen_Label_sample", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }