Exemple #1
0
        private void prntDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.PageUnit = GraphicsUnit.Millimeter;

            Ean13 barcode = new Ean13();

            int adet  = Convert.ToInt32(nmBarkodAdet.Value);
            int xx    = (int)bA_SolKenarBosluk.Value;
            int yy    = (int)bA_ustKenarBosluk.Value;
            int satir = 1;

            for (int i = 1; i <= bA_satirAdet.Value * bA_sutunAdet.Value; i++)
            {
                if (_yazilan >= adet || satir > bA_satirAdet.Value)
                {
                    return;
                }
                else
                {
                    _sonBarkod++;
                }

                barcode.ChecksumDigit = "0";
                if (_barkodlar == null || _barkodlar.Length == 0)
                {
                    barcode.CountryCode      = "000";
                    barcode.ManufacturerCode = "0000";
                    barcode.ProductCode      = _sonBarkod.ToString().PadLeft(5, '0');
                }
                else
                {
                    barcode.CountryCode      = _barkodlar[i - 1].Substring(0, 3);
                    barcode.ManufacturerCode = _barkodlar[i - 1].Substring(3, 4);
                    barcode.ProductCode      = _barkodlar[i - 1].Substring(7, 5);
                }

                barcode.Scale  = (float)(bA_olcek.Value * 0.01m);
                barcode.Width  = (float)bA_etiketGenislik.Value;
                barcode.Height = (float)bA_etiketYukseklik.Value;
                barcode.DrawEan13Barcode(e.Graphics, new PointF(xx, yy));
                xx += (int)bA_sutunBosluk.Value + (int)bA_etiketGenislik.Value;
                if (i % (int)bA_sutunAdet.Value == 0)
                {
                    xx  = (int)bA_SolKenarBosluk.Value;
                    yy += (int)bA_etiketYukseklik.Value + (int)bA_satirBosluk.Value;
                    satir++;
                }
                _yazilan++;
            }
            e.HasMorePages = _yazilan < adet;
        }
        private void createBarcode()
        {
            Ean13 ean13 = new Ean13();

            if (barcodeVal.Length >= 12)
            {
                ean13.CountryCode      = barcodeVal.Substring(0, 3);
                ean13.ManufacturerCode = barcodeVal.Substring(3, 5);
                ean13.ProductCode      = barcodeVal.Substring(8, 4);

                Bitmap img = new Bitmap(150, 150);

                //System.Drawing.Graphics g = this.picBarcode.CreateGraphics( );
                System.Drawing.Graphics g = Graphics.FromImage(img);
                g.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.SystemColors.Control),
                                new Rectangle(0, 0, img.Width, img.Height));



                ean13.DrawEan13Barcode(g, new System.Drawing.Point(25, 5), companyName, productName);

                Byte[] bytes        = imageToByteArray(img);
                string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);

                // picBarcode.Image = bytes;

                ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report/barcode_Print.rdlc");

                //create new data set to be added
                DataTable dt = new DataTable();
                dt.Columns.Add("barcodeValue", typeof(String));
                dt.Columns.Add("idColumn", typeof(int));

                for (int i = 0; i < printCount; i++)
                {
                    dt.Rows.Add(base64String, i);
                }

                ReportDataSource dataSource = new ReportDataSource("barcodeDisplay", dt);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(dataSource);
                // ReportViewer1.Visible = true;
                ReportViewer1.LocalReport.Refresh();
                g.Dispose();
            }
        }
Exemple #3
0
        private void montaGrafico()
        {
            img1.Width  = 40;
            img1.Height = 35;
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img1.Width * 6, img1.Height * 6);

            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);

            g.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color.White),
                            new Rectangle(0, 0, bmp.Width, bmp.Height));

            CreateEan13();
            ean13.Scale = 1.5F;
            ean13.DrawEan13Barcode(g, new System.Drawing.Point(0, 0));
            g.Dispose();

            bmp.Save(Server.MapPath("~/Imagens/cod.bmp"));
            img1.Src = "~/Imagens/cod.bmp";
            img2.Src = img3.Src = img4.Src = img1.Src;
        }
Exemple #4
0
        // Token: 0x060000AA RID: 170 RVA: 0x00006A38 File Offset: 0x00004C38
        private void Tag_Draw(int topx, int topy, Graphics grap, string content)
        {
            Dictionary <string, object> dc = JsonConvert.DeserializeObject <Dictionary <string, object> >(content);
            bool flag = dc["errcode"].ToString() != "0";

            if (!flag)
            {
                JArray jArr  = ( JArray )dc["data"];
                bool   flag2 = jArr.Count == 0;
                if (!flag2)
                {
                    grap.FillRectangle(this.brush, new Rectangle(topx - 1, topy - 1, 96, 14));
                    grap.FillRectangle(this.brush, new Rectangle(topx - 1, topy + 56 - 1, 96, 2));
                    grap.FillRectangle(this.brush, new Rectangle(topx - 1, topy - 1, 2, 58));
                    grap.FillRectangle(this.brush, new Rectangle(topx + 95 - 2, topy - 1, 2, 58));
                    int    currenttopx = topx + 5;
                    int    currenttopy = topy + 8;
                    string imgPath     = "http://webt.lilang.com:9001";
                    Bitmap bitQR       = new QRCodeEncoder {
                        QRCodeScale   = 1,
                        QRCodeVersion = 4
                    }.Encode(this.getItemInfo(jArr, "二维码"));
                    Ean13 _ean13 = new Ean13(this.getItemInfo(jArr, "国标码"));
                    _ean13.Scale = 0.8f;
                    Image       ImgCode128  = Code128Rendering.MakeBarcodeImage(this.getItemInfo(jArr, "唯一码"), 1, false);
                    Bitmap      bitCode128  = new Bitmap(ImgCode128);
                    WebRequest  webRequest  = WebRequest.Create(new Uri(imgPath + "/tl_yf/sxtb/lilanz-ku-white.png"));
                    WebResponse webResponse = webRequest.GetResponse();
                    Bitmap      ico         = new Bitmap(webResponse.GetResponseStream());
                    grap.DrawImage(ico, new Rectangle(currenttopx, currenttopy - 6, 23, 4), 0, 0, ico.Width, ico.Height, GraphicsUnit.Pixel);
                    grap.DrawString("品名 :", this.font, this.brushWhite, new Point(currenttopx, currenttopy));
                    grap.DrawString(this.getItemInfo(jArr, "品名"), this.font, this.brushWhite, new Point(currenttopx + 7, currenttopy));
                    grap.DrawString("统一零售价 :", this.font8Reg, this.brushWhite, new Point(currenttopx + 50, currenttopy - 4));
                    grap.DrawString("¥" + this.getItemInfo(jArr, "零售价"), this.font14, this.brushWhite, new Point(currenttopx + 67, currenttopy - 5));
                    currenttopy += 6;
                    this.DrawItem(grap, "尺码 :", this.getItemInfo(jArr, "鞋码"), currenttopx, currenttopy);
                    currenttopy += 4;
                    this.DrawItem(grap, "鞋型 :", this.getItemInfo(jArr, "鞋型"), currenttopx, currenttopy);
                    currenttopy += 4;
                    this.DrawItem(grap, "等级 :", this.getItemInfo(jArr, "等级"), currenttopx, currenttopy);
                    currenttopy += 5;
                    grap.DrawString("货号 :", this.font10, this.brush, new Point(currenttopx, currenttopy - 1));
                    grap.DrawString(this.getItemInfo(jArr, "货号"), this.font10, this.brush, new Point(currenttopx + 9, currenttopy - 1));
                    grap.DrawLine(this.penBlack, new Point(currenttopx + 28, currenttopy + 6), new Point(currenttopx + 28, currenttopy + 26));
                    currenttopy += 5;
                    grap.FillRectangle(this.brushred, new Rectangle(currenttopx + 1, currenttopy, 22, 22));
                    Font Fontcm = new Font("微软雅黑", 36f, FontStyle.Bold);
                    grap.DrawString(Regex.Replace(this.getItemInfo(jArr, "鞋码"), "(.*\\()(.*)(\\).*)", "$2"), Fontcm, this.brush, new Point(currenttopx + 2, currenttopy + 2));
                    currenttopx += 33;
                    currenttopy -= 18;
                    List <Dictionary <string, string> > mariList = this.MarifList(this.getItemInfo(jArr, "纤维含量"));
                    for (int i = 0; i < mariList.Count; i++)
                    {
                        bool flag3 = i == 0;
                        if (flag3)
                        {
                            this.DrawItem(grap, "材质 :", mariList[i]["sz"], currenttopx, currenttopy);
                        }
                        else
                        {
                            this.DrawItem(grap, "材质 :", mariList[i]["sz"], currenttopx + 7, currenttopy);
                            currenttopy += 3;
                        }
                    }
                    currenttopy += 15;
                    this.DrawItem(grap, "检验 :", "", currenttopx, currenttopy);
                    webRequest  = WebRequest.Create(new Uri(imgPath + "/tl_yf/sxtb/不干胶合格.png"));
                    webResponse = webRequest.GetResponse();
                    ico         = new Bitmap(webResponse.GetResponseStream());
                    grap.DrawImage(ico, new Rectangle(currenttopx + 8, currenttopy - 4, 9, 7), 0, 0, ico.Width, ico.Height, GraphicsUnit.Pixel);
                    currenttopy += 6;
                    this.DrawItem(grap, "执行标准 :", this.getItemInfo(jArr, "执行标准"), currenttopx, currenttopy);
                    currenttopy += 6;
                    grap.DrawImage(bitQR, new Rectangle(currenttopx, currenttopy - 2, 15, 14), 0, 0, bitQR.Width, bitQR.Height, GraphicsUnit.Pixel);
                    Uri myUri = new Uri(imgPath + "/" + this.getItemInfo(jArr, "图片"));
                    webRequest  = WebRequest.Create(myUri);
                    webResponse = webRequest.GetResponse();
                    ico         = new Bitmap(webResponse.GetResponseStream());
                    grap.DrawImage(ico, new Rectangle(topx + 62, topy + 14, 26, 13), 0, 0, ico.Width, ico.Height, GraphicsUnit.Pixel);
                    this.DrawItem4(grap, "颜色 :", this.getItemInfo(jArr, "商品档案名称").Split(new char[]
                    {
                        '-'
                    })[1], currenttopx + 35, currenttopy - 11);
                    currenttopx += 22;
                    currenttopy -= 2;
                    _ean13.DrawEan13Barcode(grap, new Point(currenttopx, currenttopy));
                    currenttopx--;
                    currenttopy += 7;
                    grap.DrawImage(bitCode128, new Rectangle(currenttopx, currenttopy, 30, 3), 0, 0, bitCode128.Width, bitCode128.Height, GraphicsUnit.Pixel);
                    currenttopx++;
                    currenttopy += 3;
                    grap.DrawString(this.getItemInfo(jArr, "唯一码"), this.FontCode128, this.brush, new Point(currenttopx, currenttopy));
                    currenttopx += 7;
                    currenttopy += 4;
                    grap.DrawString("(仅供内部使用)", this.font4, this.brush, new Point(currenttopx, currenttopy - 1));
                    currenttopx += 34;
                    currenttopy -= 48;
                    this.DrawItem(grap, "品名 :", this.getItemInfo(jArr, "品名"), currenttopx, currenttopy);
                    currenttopy += 4;
                    this.DrawItem(grap, "货号 :", this.getItemInfo(jArr, "货号"), currenttopx, currenttopy);
                    currenttopy += 4;
                    this.DrawItem(grap, "尺码 :", this.getItemInfo(jArr, "鞋码"), currenttopx, currenttopy);
                    currenttopy += 4;
                    this.DrawItem3(grap, "鞋型 :", this.getItemInfo(jArr, "鞋型"), currenttopx, currenttopy);
                    currenttopy += 3;
                    for (int j = 0; j < mariList.Count; j++)
                    {
                        bool flag4 = j == 0;
                        if (flag4)
                        {
                            this.DrawItem3(grap, "材质 :", mariList[j]["sz"], currenttopx, currenttopy);
                        }
                        else
                        {
                            this.DrawItem3(grap, "材质 :", mariList[j]["sz"], currenttopx + 6, currenttopy);
                            currenttopy += 3;
                        }
                    }
                    currenttopy += 3;
                    this.DrawItem3(grap, "颜色 :", this.getItemInfo(jArr, "商品档案名称").Split(new char[]
                    {
                        '-'
                    })[1], currenttopx, currenttopy);
                    currenttopy += 3;
                    this.DrawItem3(grap, "等级 :", this.getItemInfo(jArr, "等级"), currenttopx, currenttopy);
                    currenttopy += 3;
                    this.DrawItem3(grap, "执行标准 :", this.getItemInfo(jArr, "执行标准"), currenttopx, currenttopy);
                    currenttopy += 3;
                    this.DrawItem3(grap, "检验 :", this.getItemInfo(jArr, "检验"), currenttopx, currenttopy);
                    currenttopy += 4;
                    this.DrawItem3(grap, "统一零售价 :", this.getItemInfo(jArr, "零售价"), currenttopx, currenttopy);
                    currenttopx--;
                    currenttopy += 3;
                    _ean13.DrawEan13Barcode(grap, new Point(currenttopx, currenttopy));
                    currenttopx--;
                    currenttopy += 8;
                    grap.DrawImage(bitCode128, new Rectangle(currenttopx, currenttopy, 30, 3), 0, 0, bitCode128.Width, bitCode128.Height, GraphicsUnit.Pixel);
                    currenttopx++;
                    currenttopy += 3;
                    grap.DrawString(this.getItemInfo(jArr, "唯一码"), this.FontCode128, this.brush, new Point(currenttopx, currenttopy));
                    currenttopx += 7;
                    currenttopy += 3;
                    grap.DrawString("(仅供内部使用)", this.font4, this.brush, new Point(currenttopx, currenttopy));
                }
            }
        }