Ejemplo n.º 1
0
        private void btnDetailedView_Click(object sender, EventArgs e)
        {
            FormQRsInGrid frmQRsInGrid = new FormQRsInGrid(this.picResult1.Image, this.cbxRowAndColumn, this.txtHorizontal, this.txtVertical);

            frmQRsInGrid.Show();
        }
Ejemplo n.º 2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (txtHorizontal.Text.Length <= 0 && txtVertical.Text.Length <= 0)
            {
                if (cbxQRType.SelectedItem.ToString() == "1D")
                {
                    if (txtProductID.Text.ToString().Length <= 0)
                    {
                        MessageBox.Show("Hãy nhập mã hàng", "Thông báo", MessageBoxButtons.OK);
                        return;
                    }
                    Zen.Barcode.Code128BarcodeDraw qrcode1d = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum;
                    string lblProductIDCut = lblProductID.ToString().Replace(" ", "");
                    picResult.Image = qrcode1d.Draw(lblProductIDCut.Trim() + txtProductID.Text.Trim() + " | " + txtProductName.Text.ToString(), 100);



                    if (cbxRowAndColumn.Text.Length <= 0)
                    {
                        cbxRowAndColumn.SelectedIndex = 0;
                    }
                    if (cbxRowAndColumn.SelectedItem.ToString() == "1")
                    {
                        this.btnDetailedView.Enabled = false;
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "2")
                    {
                        #region cotvadong=2
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 380;                         //adjustable
                        int    height   = 380;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "3")
                    {
                        #region cotvadong=3
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 570;                         //adjustable
                        int    height   = 570;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "4")
                    {
                        #region cotvadong=4
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 760;                         //adjustable
                        int    height   = 760;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }

                    FormQRsInGrid frmQRsInGrid = new FormQRsInGrid(this.picResult1.Image, this.cbxRowAndColumn, this.txtHorizontal, this.txtVertical);
                    this.panelResult.Enabled = true;
                    this.picResult.Visible   = true;
                    this.btnSave.Enabled     = true;
                    if (this.cbxRowAndColumn.SelectedIndex != 0)
                    {
                        this.btnDetailedView.Enabled = true;
                    }
                }
                else if (cbxQRType.SelectedItem.ToString() == "2D")
                {
                    if (txtProductID.Text.ToString().Length <= 0)
                    {
                        MessageBox.Show("Hãy nhập mã hàng", "Thông báo", MessageBoxButtons.OK);
                        return;
                    }
                    Zen.Barcode.CodeQrBarcodeDraw qrcode2d = Zen.Barcode.BarcodeDrawFactory.CodeQr;
                    string lblProductIDCut = lblProductID.Text.Replace(" ", "");
                    picResult.Image = qrcode2d.Draw(lblProductIDCut.Trim() + txtProductID.Text.Trim() + " | " + txtProductName.Text.ToString(), 50);

                    if (cbxRowAndColumn.Text.Length <= 0)
                    {
                        cbxRowAndColumn.SelectedIndex = 0;
                    }
                    if (cbxRowAndColumn.SelectedItem.ToString() == "1")
                    {
                        this.btnDetailedView.Enabled = false;
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "2")
                    {
                        #region cotvadong=2
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 380;                         //adjustable
                        int    height   = 380;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "3")
                    {
                        #region cotvadong=3
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 570;                         //adjustable
                        int    height   = 570;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "4")
                    {
                        #region cotvadong=4
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 760;                         //adjustable
                        int    height   = 760;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    FormQRsInGrid frmQRsInGrid = new FormQRsInGrid(this.picResult1.Image, this.cbxRowAndColumn, this.txtHorizontal, this.txtVertical);
                    this.panelResult.Enabled = true;
                    this.picResult.Visible   = true;
                    this.btnSave.Enabled     = true;
                    if (this.cbxRowAndColumn.SelectedIndex != 0)
                    {
                        this.btnDetailedView.Enabled = true;
                    }
                }
            }
            else
            {
                //this.cbxRowAndColumn.SelectedIndex = 0;
                if (txtProductID.Text.ToString().Length <= 0)
                {
                    MessageBox.Show("Hãy nhập mã hàng", "Thông báo", MessageBoxButtons.OK);
                    return;
                }
                Zen.Barcode.CodeQrBarcodeDraw qrcode2d = Zen.Barcode.BarcodeDrawFactory.CodeQr;
                string lblProductIDCut = lblProductID.Text.Replace(" ", "");
                picResult.Image = qrcode2d.Draw(lblProductIDCut.Trim() + txtProductID.Text.Trim() + " | " + txtProductName.Text.ToString(), 50);
                Image  imgsmall = this.picResult.Image;
                int    width    = Convert.ToInt32(this.txtHorizontal.Text);
                int    height   = Convert.ToInt32(this.txtVertical.Text);
                Bitmap imgFinal = new Bitmap(width, height);
                xuLyIn(width, height, imgsmall, imgFinal);

                this.panelResult.Enabled     = true;
                this.picResult.Visible       = true;
                this.btnSave.Enabled         = true;
                this.btnDetailedView.Enabled = true;
            }
        }