Exemplo n.º 1
0
        private void Print(DataGridView gv, string cb_chck, Constants.BarCodeLayout layout)
        {
            bool R     = false;
            int  count = Convert.ToInt32(gv.Rows.Count.ToString());

            for (int i = 0; i < count; i++)
            {
                DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)gv.Rows[i].Cells[cb_chck];
                Boolean flag = Convert.ToBoolean(checkCell.Value);
                if (!flag)
                {
                    continue;
                }
                R = true;
                DataGridViewRow row  = gv.Rows[i];
                InstrumentModel item = (InstrumentModel)row.DataBoundItem;
                for (int j = 0; j < int.Parse(txtinstrumentNum.Text); j++)
                {
                    Print(item, layout);
                }
            }
            if (!R)
            {
                MessageBox.Show("未勾选任何记录");
            }
        }
Exemplo n.º 2
0
        public void Print(Constants.BarCodeLayout Layout)
        {
            PrintLayoutEventArgs e = new PrintLayoutEventArgs();

            e.Layout = Layout;
            OnPrintEvent(e);
            this.Close();
        }
Exemplo n.º 3
0
        private void Print(InstrumentModel m, Constants.BarCodeLayout layout)
        {
            // 打开 打印机 端口.
            try
            {
                if (string.IsNullOrEmpty(comboBox1.SelectedItem.ToString()))
                {
                    MessageBox.Show("请选择打印机。");
                    return;
                }
                TSCLIB_DLL.openport(comboBox1.SelectedItem.ToString());                                                //Open
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}打印机安装出错或没有安装驱动。", comboBox1.SelectedItem.ToString()));
                return;
            }
            switch (layout)
            {
            case Constants.BarCodeLayout.二维码左:
                QRCode_ABPrint(m);
                break;

            case Constants.BarCodeLayout.二维码右:
                QRCode_BAPrint(m);
                break;

            case Constants.BarCodeLayout.条码上:
                BarCode_ABPrint(m);
                break;

            case Constants.BarCodeLayout.条码下:
                BarCode_BAPrint(m);
                break;

            case Constants.BarCodeLayout.混合条码上:
                MixCode_ABPrint(m);
                break;

            case Constants.BarCodeLayout.混合条码下:
                MixCode_BAPrint(m);
                break;
            }

            //// if (radioButton1.Checked)//二维码
            //     QRCodePrint(m, layout);//二维码
            // //else if (radioButton2.Checked)//条形码
            //     BarCodePrint(m, layout);//条形码
            // //else
            // MixCodePrint(m, layout);//混合
        }