Exemple #1
0
        private void btnGenerarCodigoBarra_Click(object sender, EventArgs e)
        {
            int    c      = 0;
            Random r      = new Random();
            int    nro    = 0;
            string codigo = "";

            while (c < 10)
            {
                nro = r.Next(0, 10);
                if (c == 0)
                {
                    codigo = nro.ToString();
                }
                else
                {
                    codigo = codigo + nro.ToString();
                }
                c++;
            }
            txtCodigoBarra.Text = codigo;
            BarcodeLib.Barcode CodBar = new BarcodeLib.Barcode();
            //panel1.BackgroundImage = codigo.Encode(BarcodeLib.TYPE.CODE128, "12345678988877744521", Color.Black, Color.White, 300, 300);
            ImagenCodigo.Image = CodBar.Encode(BarcodeLib.TYPE.CODE128, codigo, Color.Black, Color.White, 300, 300);
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            String _STR;
            Image  BARfile;

            _STR = textBox1.Text.ToString().Trim();
            if (_STR.Length < 1)
            {
                MessageBox.Show("您还没输入数字字符!");
                return;
            }
            string D = "0123456789";

            for (int k = 0; k < _STR.Length; k++)
            {
                string subD = _STR.Substring(k, 1);
                if (D.IndexOf(subD) < 0)
                {
                    MessageBox.Show("输入的内容含有非法字符!" + subD);
                    return;
                }
            }
            BarcodeLib.Barcode barCode = new BarcodeLib.Barcode();
            BARfile           = barCode.Encode(BarcodeLib.TYPE.CODE128, _STR, 300, 100);
            pictureBox1.Image = BARfile;
            button2.Enabled   = true;
        }
Exemple #3
0
 private void BtnGenerar_Click(object sender, EventArgs e)
 {
     BarcodeLib.Barcode Codigo = new BarcodeLib.Barcode();
     Codigo.IncludeLabel         = true;
     PanelCodigo.BackgroundImage = Codigo.Encode(BarcodeLib.TYPE.CODE128, TxtCodigo.Text, Color.Black, Color.White, 400, 100);
     BtnGuardarCodigo.Enabled    = true;
 }
Exemple #4
0
 private static void GenerateBacode(string _data, string _filename)
 {
     BarcodeLib.Barcode b = new BarcodeLib.Barcode();
     b.IncludeLabel = true;
     Image img = b.Encode(BarcodeLib.TYPE.CODE128, _data, Color.Black, Color.White, 235, 50);
     img.Save(_filename);
 }
Exemple #5
0
 public void agregar()
 {
     try
     {
         BarcodeLib.Barcode codigo = new BarcodeLib.Barcode();
         codigo.IncludeLabel = true;
         Image img = (Image)codigo.Encode(BarcodeLib.TYPE.CODE128B, txtClave.Text, Color.Black, Color.White, 300, 100);
         img.Dispose();
         clave = DAOProductos.existeProducto(txtClave.Text) ? null : txtClave.Text;
         if (clave != null)
         {
             this.Close();
         }
         else
         {
             MessageBox.Show("Este código ya existe en la base de datos", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtClave.Text = "";
             txtClave.Focus();
         }
     }
     catch
     {
         MessageBox.Show("Error al crear código de barras\nRevise que no haya usado caracteres especiales o la letra ñ", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public Image GenerarCodigoBarra()
        {
            BarcodeLib.Barcode b = new BarcodeLib.Barcode();
            Image img            = b.Encode(BarcodeLib.TYPE.CODE128, tarjas, Color.Black, Color.White, 290, 120);

            return(img);
        }
Exemple #7
0
        public JsonResult GuardarArticulo(string codigo, string descripocionCorta, string descripcionLarga, int stockMinimo, int stockMaximo, int idCategoria, bool isConsumible)
        {
            BarcodeLib.Barcode codigoBarras = new BarcodeLib.Barcode();
            codigoBarras.IncludeLabel = true;
            Image imagen = codigoBarras.Encode(BarcodeLib.TYPE.CODE128, codigo, Color.Black, Color.White, 400, 100);

            int idCompania = ((DO_Persona)Session["UsuarioConectado"]).idCompania;

            DO_Articulo articulo = new DO_Articulo();

            articulo.Codigo         = codigo;
            articulo.CodigoDeBarras = DataManager.ImageToByteArray(imagen);
            articulo.Descripcion    = descripocionCorta;
            articulo.NumeroDeSerie  = descripcionLarga;
            articulo.ID_CATEGORIA   = idCategoria;
            articulo.stockMax       = stockMaximo;
            articulo.stockMin       = stockMinimo;
            articulo.idCompania     = idCompania;
            articulo.IsConsumible   = isConsumible;

            int result = DataManager.InsertArticulo(articulo);

            var jsonResult = Json(result, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;

            return(jsonResult);
        }
Exemple #8
0
 private void textBox2_TextChanged(object sender, EventArgs e)
 {
     BarcodeLib.Barcode Codigo = new BarcodeLib.Barcode();
     Codigo.IncludeLabel     = true;
     panelcb.BackgroundImage = Codigo.Encode(BarcodeLib.TYPE.CODE128, textBox2.Text, Color.Black, Color.White, 200, 50);
     button2.Enabled         = true;
 }
        public void BarcodesPDF()// Штрих код генерация
        {
            /// Для отображения русских букв
            var baseFont = BaseFont.CreateFont(@"C:\Windows\Fonts\Arial.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            var font     = new iTextSharp.text.Font(baseFont, 12);
            var barcode  = new BarcodeLib.Barcode();
            var sfd      = new SaveFileDialog {
                FileName = "Barcodes", Filter = "PDF file (*.pdf)|*.pdf"
            };

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                var Doc    = new Document(new iTextSharp.text.Rectangle(165, 1000), 1f, 1f, 1f, 1f);/// для чека - 58мм на 38мм
                var Stream = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write, FileShare.None);
                PdfWriter.GetInstance(Doc, Stream);
                Doc.Open();

                for (int i = 0; i < Table.DtInvoice.Rows.Count; i++)
                {
                    var item         = Table.DtInvoice.Rows[i][2].ToString();
                    var imageBarcode = barcode.Encode(BarcodeLib.TYPE.CODE128B, item, Color.Black, Color.White, 165, 50);/// CODE39
                    var image        = Image.GetInstance(imageBarcode, ImageFormat.Jpeg);
                    Doc.Add(new Paragraph($"Спецсвязь {item}", font));
                    Doc.Add(image);
                }
                Doc.Close();
                // Открытие созданного файла
                Process.Start(sfd.FileName);
            }
        }
Exemple #10
0
        /// <summary>
        /// 生成条形码方法
        /// </summary>
        /// <param name="height"></param>
        /// <param name="width"></param>
        /// <param name="type"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public static Image GetBarcode2(int height, int width, BarcodeLib.TYPE type, string code)
        {
            Image image = null;

            try
            {
                var b = new BarcodeLib.Barcode
                {
                    BackColor     = Color.White,
                    ForeColor     = Color.Black,
                    IncludeLabel  = true,
                    Alignment     = BarcodeLib.AlignmentPositions.CENTER,
                    LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER,
                    ImageFormat   = System.Drawing.Imaging.ImageFormat.Jpeg
                };
                var font = new Font("verdana", 10f); //字体设置
                b.LabelFont = font;
                b.Height    = height;                //图片高度设置(px单位)
                b.Width     = width;                 //图片宽度设置(px单位)
                image       = b.Encode(type, code);  //生成图片
            }
            catch (Exception ex)
            {
                image = null;
            }
            return(image);
        }
Exemple #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            BarcodeLib.Barcode b = new BarcodeLib.Barcode();
            Image img            = b.Encode(BarcodeLib.TYPE.CODE128, textBox1.Text, Color.Black, Color.White, 290, 120);

            pictureBox1.Image = img;
        }
Exemple #12
0
 /// <summary>
 /// 生成条形码
 /// </summary>
 /// <param name="height"></param>
 /// <param name="width"></param>
 /// <param name="type"></param>
 /// <param name="code"></param>
 /// <param name="image"></param>
 public static void GetBarcode(int height, int width, BarcodeLib.TYPE type, string code, out Image image)
 {
     try
     {
         //BarcodeLib.Barcode b = new BarcodeLib.Barcode();
         //b.BackColor = Color.White;//图片背景颜色
         //b.ForeColor = Color.Black;//条码颜色
         //b.IncludeLabel = true;
         //b.Alignment = BarcodeLib.AlignmentPositions.LEFT;
         //b.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;//code的显示位置
         //b.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;//图片格式
         //Font font = new Font("verdana", 10f);//字体设置
         //b.LabelFont = font;
         //b.Height = height;//图片高度设置(px单位)
         //b.Width = width;//图片宽度设置(px单位)
         //image = b.Encode(type, code);//生成图片
         BarcodeLib.Barcode b = new BarcodeLib.Barcode();
         b.BackColor     = System.Drawing.Color.White; //图片背景颜色
         b.ForeColor     = System.Drawing.Color.Black; //条码颜色
         b.IncludeLabel  = true;
         b.Alignment     = BarcodeLib.AlignmentPositions.LEFT;
         b.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;
         b.ImageFormat   = System.Drawing.Imaging.ImageFormat.Jpeg;          //图片格式
         System.Drawing.Font font = new System.Drawing.Font("verdana", 10f); //字体设置
         b.LabelFont = font;
         b.Height    = height;                                               //图片高度设置(px单位)
         b.Width     = width;                                                //图片宽度设置(px单位)
         image       = b.Encode(type, code);
         // image.Save(fileSaveUrl, System.Drawing.Imaging.ImageFormat.Jpeg);
     }
     catch (Exception)
     {
         image = null;
     }
 }
        public Byte[] PrintToBarCode(String TextValue, int Width, int Hight)
        {
            Byte[]             PrintToBarCode;
            BarcodeLib.Barcode b;
            b = new BarcodeLib.Barcode();

            Image Img;

            b.Alignment      = BarcodeLib.AlignmentPositions.CENTER;
            b.IncludeLabel   = false;
            b.RotateFlipType = RotateFlipType.RotateNoneFlipNone;
            b.LabelPosition  = BarcodeLib.LabelPositions.BOTTOMCENTER;

            if (TextValue == "0")
            {
                Img = b.Encode(BarcodeLib.TYPE.CODE39Extended, TextValue, Color.White, Color.White, Width, Hight);
            }
            else
            {
                Img = b.Encode(BarcodeLib.TYPE.CODE39Extended, TextValue, Color.Black, Color.White, Width, Hight);
            }

            PrintToBarCode = b.Encoded_Image_Bytes;
            return(PrintToBarCode);
        }
        public Task <Image> EncodeImage(BarcodeType type, string content, int width, int height)
        {
            var barcode = new BarcodeLib.Barcode
            {
                IncludeLabel   = true,
                Alignment      = BarcodeLib.AlignmentPositions.CENTER,
                RotateFlipType = RotateFlipType.RotateNoneFlipNone,
                BackColor      = Color.White,
                ForeColor      = Color.Black,
                LabelPosition  = BarcodeLib.LabelPositions.BOTTOMCENTER,
                AlternateLabel = content
            };

            Image image;

            if (width < ImagingConstants.MinimalBarcodeWidth || height < ImagingConstants.MinimalBarcodeHeight)
            {
                image = barcode.Encode((BarcodeLib.TYPE)((int)type), content);
            }
            else
            {
                image = barcode.Encode((BarcodeLib.TYPE)((int)type), content, width, height);
            }

            return(Task.FromResult(image));
        }
Exemple #15
0
        // Generate Functions
        public void GenerateBarcode_Linear(string inputData)
        {
            LinearEncoder                = new BarcodeLib.Barcode();
            LinearEncoder.EncodedType    = BarcodeLib.TYPE.UPCA;
            LinearEncoder.AlternateLabel = Txt_InputData.Text;
            // TextBox1.Text = LinearEncoder.Country_Assigning_Manufacturer_Code;
            LinearEncoder.BackColor     = Color.White;
            LinearEncoder.ForeColor     = Color.Black;
            LinearEncoder.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;
            LinearEncoder.IncludeLabel  = false;

            //
            try
            {
                LinearEncoder.LabelFont = new Font(FontFamily.GenericSansSerif, 12.0F, FontStyle.Regular);
                Linearimg = LinearEncoder.Encode((BarcodeLib.TYPE) 34, inputData);//, Color.Black, Color.White, 200, 200);

                Linearbitmap = new Bitmap(Linearimg);

                barcodeImage = Linearbitmap;

                PicBox1.Image = barcodeImage;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #16
0
        public void SetControlValue(string[] arrsValue)
        {
            try
            {
                this.lblZYH.Text  = string.Empty;
                this.lblName.Text = string.Empty;
                this.lblDept.Text = string.Empty;

                this.lblZYH.Text  = arrsValue[0].TrimStart('0');
                this.lblName.Text = arrsValue[1];
                this.lblDept.Text = arrsValue[2];
                string barCodeValue = arrsValue[3];
                this.lblOutDate.Text = arrsValue[4];

                BarcodeLib.Barcode barCode = new BarcodeLib.Barcode();
                barCode.IncludeLabel = false;

                this.PicBoxBarCode.Image = barCode.Encode(BarcodeLib.TYPE.CODE128, barCodeValue, Color.Black, Color.White, barCode.Width, barCode.Height);
                p.IsResetPage            = true;

                ps.Height = PrintHeight;
                ps.Width  = PrintWidth;
            }
            catch
            {
                this.lblZYH.Text    = string.Empty;
                this.lblName.Text   = string.Empty;
                this.lblDept.Text   = string.Empty;
                PicBoxBarCode.Image = null;
            }
        }
Exemple #17
0
        public static String GenBarcodeImg(String Barcode)
        {
            BarcodeLib.Barcode barcode = new BarcodeLib.Barcode()
            {
                IncludeLabel   = true,
                Alignment      = BarcodeLib.AlignmentPositions.CENTER,
                Width          = 230,
                Height         = 100,
                RotateFlipType = RotateFlipType.RotateNoneFlipNone,
                BackColor      = Color.White,
                ForeColor      = Color.Black,
            };
            Image  img  = barcode.Encode(BarcodeLib.TYPE.EAN13, Barcode);
            String path = VariableDB.PathBarcodeImage;

            if (!Directory.Exists(path))
            {
                DirectoryInfo di = Directory.CreateDirectory(path);
            }
            String Filename        = path + "/" + Barcode + ".jpg";
            String Filename_nopath = Barcode + ".jpg";

            img.Save(Filename, System.Drawing.Imaging.ImageFormat.Jpeg);

            return(Filename);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string DatenbezeichnerGLN = "01";
            string DatenbezeichnerNVE = "00";
            string DatenbezeichnerProduktionsdatum = "11";
            string DatenbezeichnerChargenNummer    = "10";
            string DatenbezeichnerMHD   = "15";
            string DatenbezeichnerMenge = "37";
            string Datenbezeichner      = "00";
            string DatenbezeichernGTIN  = "02";
            string EANGTIN          = "4260046693352";
            string GLNBasis         = "4013493";
            string Reserveziffer    = "3";
            string GLN              = "4013493000002";
            string Produktionsdatum = "311218";
            string VarNummer        = "000000001";
            string ChargenNummer    = "181231";
            string Menge            = "0095";
            string MHD              = "190131";

            string NVERohdaten = Reserveziffer + GLNBasis + VarNummer;
            string Barcode1    = DatenbezeichernGTIN + EANGTIN + DatenbezeichnerMHD + MHD + DatenbezeichnerMenge + Menge;
            string Barcode2    = DatenbezeichnerNVE + NVERohdaten + PrüfzifferBerechnen(NVERohdaten) + DatenbezeichnerChargenNummer + ChargenNummer;

            //int NVERohdatenINT = Int32.Parse(NVERoh);
            //int Prüfziffer = PrüfzifferBerechnen(NVERohdatenINT);


            BarcodeLib.Barcode   b    = new BarcodeLib.Barcode();
            System.Drawing.Image img  = b.Encode(BarcodeLib.TYPE.CODE128, Barcode1, System.Drawing.Color.Black, System.Drawing.Color.White, 800, 240);
            System.Drawing.Image img2 = b.Encode(BarcodeLib.TYPE.CODE128, Barcode2, System.Drawing.Color.Black, System.Drawing.Color.White, 800, 240);
            BarcodeIMG2.Source = ToWpfImage(img2);
            BarcodeIMG.Source  = ToWpfImage(img);
        }
Exemple #19
0
        public int SetValue(Neusoft.HISFC.Models.RADT.PatientInfo patientInfo)
        {
            string age = Neusoft.HISFC.BizProcess.Integrate.Function.GetAge(patientInfo.Birthday);

            try
            {
                //姓名
                this.lblname.Text = string.Format("姓名:{0}", patientInfo.Name);
                //性别
                this.lblsex.Text = string.Format("性别:{0}", patientInfo.Sex.Name);
                //年龄
                this.lblage.Text = string.Format("年龄:{0}", age);//patientInfo.Age;
                //入院日期
                //this.lblindate.Text =string.Format("", patientInfo.PVisit.InTime.ToString();
                //住院科室
                this.lbldeptname.Text = string.Format("科别:{0}", patientInfo.PVisit.PatientLocation.Dept.Name);
                //住院号码
                this.lblpatientinfo.Text = string.Format("住院号:{0}", patientInfo.PID.PatientNO);

                //条码
                BarcodeLib.Barcode b    = new BarcodeLib.Barcode();
                BarcodeLib.TYPE    type = BarcodeLib.TYPE.CODE128;
                //===== Encoding performed here =====
                b.IncludeLabel = true;
                barcode.Image  = b.Encode(type, patientInfo.ID, System.Drawing.Color.Black, System.Drawing.Color.White, barcode.Width, barcode.Height);
            }
            catch (Exception ex)
            {
                return(-1);
            }
            return(1);
        }
        public static string GenerateResetLabel(Bitmap bmLabel, string labelText, string saveLocation)
        {
            string savePath = saveLocation + labelText.Replace('/', '_') + "- Reset" + ".jpg";

            try
            {
                BarcodeLib.Barcode b = new BarcodeLib.Barcode();
                b.Alignment = BarcodeLib.AlignmentPositions.CENTER;
                BarcodeLib.TYPE type = BarcodeLib.TYPE.CODE128;

                if (type != BarcodeLib.TYPE.UNSPECIFIED)
                {
                    b.IncludeLabel = false;
                    Image    barCodeIMG = b.Encode(type, labelText, 250, 50);
                    Bitmap   originalBM = new Bitmap(bmLabel);
                    Graphics graphics   = Graphics.FromImage(originalBM);

                    graphics.DrawString("Reset", new Font("Calibri", 24, FontStyle.Bold), Brushes.Black, 20, 10);

                    graphics.DrawImage(barCodeIMG, 10, 200, 250, 50);
                    originalBM.Save(savePath, originalBM.RawFormat);
                    //originalBM.Dispose();
                    graphics.Dispose();
                }
            }
            catch (Exception ex)
            {
                IndicoLogging.log.Error("Error occured while generating Reset Barcode Label from GenerateBarcode.cs", ex);
            }

            return(savePath);
        }
Exemple #21
0
 private void button5_Click(object sender, EventArgs e)
 {
     BarcodeLib.Barcode Codigo = new BarcodeLib.Barcode();
     Codigo.IncludeLabel            = true;
     panelResultado.BackgroundImage = Codigo.Encode(BarcodeLib.TYPE.CODE128, txtCodigo.Text, Color.Black, Color.White, 400, 100);
     btnGuardar.Enabled             = true;
 }
 private void BtnGenerarCodigo_Click(object sender, EventArgs e)
 {
     BarcodeLib.Barcode codigo = new BarcodeLib.Barcode();
     codigo.IncludeLabel             = true;
     pnlCodigoBarras.BackgroundImage = codigo.Encode(BarcodeLib.TYPE.CODE128, txtCodigo.Text, Color.Black, Color.White, 400, 100);
     btnGuardarCodigo.Enabled        = true;
     btnImprimirCodigo.Enabled       = true;
 }
Exemple #23
0
        private Image generateBarcodeImage(String barcodeNumber)
        {
            BarcodeLib.Barcode b = new BarcodeLib.Barcode();
            Image img            = b.Encode(BarcodeLib.TYPE.UPCA, barcodeNumber
                                            , Color.Black, Color.White, 365, 135);

            return(img);
        }
Exemple #24
0
        private iTextSharp.text.Image GetBarcodeImage()
        {
            var       barcode          = new BarcodeLib.Barcode();
            BaseColor color            = null;
            var       inputImageStream = barcode.Encode(BarcodeLib.TYPE.CODE39Extended, GetData(), Color.Black, Color.White, 250, 50);

            iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(inputImageStream, color);
            return(image);
        }
Exemple #25
0
        /// <summary>
        /// 生成条形码
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public System.Drawing.Image MakeBarcode(string code)
        {
            BarcodeLib.Barcode b = new BarcodeLib.Barcode();
            b.Height = 50;
            b.Width  = 233;
            var image = b.Encode(BarcodeLib.TYPE.CODE128, code);

            return(image);
        }
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            string ctg  = cmbProductCtg.Text.Trim().Replace("'", "''");
            string name = cmbProductName.Text.Trim().Replace("'", "''");
            string size = cmbProductSize.Text.Trim().Replace("'", "''");

            pId = obj.funPrdId(obj.funCtgId(ctg), name, size);
            //this query for last quant
            SqlDataAdapter sd  = new SqlDataAdapter("SELECT tblBarcode.pId as pId, tblBarcode.barcode as barcode, tblStock.sPrice as Price, tblProducts.pSize as Size FROM tblBarcode INNER JOIN tblStock ON tblBarcode.pId = tblStock.pId INNER JOIN tblProducts ON tblStock.pId = tblProducts.pId where tblBarcode.pId = '" + pId + "' ", obj.con);
            DataTable      dtl = new DataTable();

            sd.Fill(dtl);
            if (dtl.Rows.Count < 1)
            {
                MessageBox.Show("This product is not available", "Warning");
                return;
            }
            else
            {
                pnlBarcode.Visible = true;
                brCodetxt          = dtl.Rows[0]["barcode"].ToString();
                double price = Convert.ToDouble(dtl.Rows[0]["Price"].ToString());
                string sz    = dtl.Rows[0]["Size"].ToString();

                BarcodeLib.Barcode barcode = new BarcodeLib.Barcode();
                Image img = barcode.Encode(BarcodeLib.TYPE.CODE128, brCodetxt, Color.Black, Color.White, 150, 60);
                pictureBox1.Image = img;

                this.appData1.Clear();
                using (MemoryStream ms = new MemoryStream())
                {
                    img.Save(ms, ImageFormat.Png);
                    int n = Convert.ToInt16(txtCurentStock.Text);
                    if (n < 4)
                    {
                        n = 1;
                    }
                    else
                    {
                        if (n % 4 == 0)
                        {
                            n = (n / 4);
                        }
                        else
                        {
                            n = (n / 4) + 1;
                        }
                    }
                    for (int i = 0; i < n; i++)
                    {
                        this.appData1.Barcode.AddBarcodeRow(brCodetxt, ms.ToArray(), price, sz);
                    }
                }

                barcodeInitaialization(this.appData1.Barcode);
            }
        }
Exemple #27
0
 internal Image getBarCode(string Code, int W, int H)
 {
     BarcodeLib.Barcode b    = new BarcodeLib.Barcode();
     BarcodeLib.TYPE    type = BarcodeLib.TYPE.UNSPECIFIED;
     type           = BarcodeLib.TYPE.CODE128;
     b.IncludeLabel = false;
     //===== Encoding performed here =====
     return(b.Encode(type, Convert.ToInt64(Code).ToString("D12"), Color.Black, Color.White, W, H));
 }
Exemple #28
0
        public static void RaporYaz()
        {
            Bitmap   SuspansiyonGorsel = new Bitmap(Properties.Resources.csuspansiyon, 2408, 3508);
            Graphics g2 = Graphics.FromImage(SuspansiyonGorsel);

            #region Araç Km
            g2.DrawString(musteridegerleri.kmsi, new Font("Calibri", 39), Brushes.Black, new PointF(1308, 695));
            #endregion
            #region Araç Plaka
            g2.DrawString(musteridegerleri.plaka, new Font("Calibri", 45), Brushes.Black, new PointF(537, 690));
            #endregion
            #region MarkaModel
            g2.DrawString(musteridegerleri.aracmodeli + " Model:" + musteridegerleri.aracyili, new Font("Calibri", 37), Brushes.Black, new PointF(140, 910));
            #endregion
            #region rENK
            g2.DrawString(musteridegerleri.renk, new Font("Calibri", 39), Brushes.Black, new PointF(1215, 825));
            #endregion
            #region Barkod
            BarcodeLib.Barcode b = new BarcodeLib.Barcode();
            b.Alignment = BarcodeLib.AlignmentPositions.LEFT;
            BarcodeLib.TYPE type = BarcodeLib.TYPE.UNSPECIFIED;
            type = BarcodeLib.TYPE.Codabar;
            g2.DrawImage(b.Encode(type, musteridegerleri.barkodno, 750, 170), new PointF(1625, 810));
            g2.DrawString(musteridegerleri.barkodno, new Font("Calibri", 30), Brushes.Black, new PointF(1860, 975));
            #endregion
            #region Tarih Saat
            g2.DrawString(DateTime.Now.ToShortDateString() + " / " + DateTime.Now.ToShortTimeString(), new Font("Calibri", 33), Brushes.Black, new PointF(1950, 700));
            #endregion
            #region AlıcıTelefon
            g2.DrawString(musteridegerleri.alicitelefon, new Font("Calibri", 33), Brushes.Black, new PointF(440, 2885));
            #endregion
            g2.DrawString(suspansiyondegerleri.solonamortisor, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(475, 2530));
            g2.DrawString(suspansiyondegerleri.solonamortisortakozu, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(475, 2590));
            g2.DrawString(suspansiyondegerleri.solonsuspansiyonkollari, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(475, 2660));
            g2.DrawString(suspansiyondegerleri.solonhelezonyayi, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(475, 2730));
            g2.DrawString(suspansiyondegerleri.solarkaamortisor, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(1000, 2530));
            g2.DrawString(suspansiyondegerleri.solarkaamortisortakozu, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(1000, 2590));
            g2.DrawString(suspansiyondegerleri.solarkasuspansiyonkollari, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(1000, 2660));
            g2.DrawString(suspansiyondegerleri.solarkahelezonyayi, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(1000, 2730));
            g2.DrawString(suspansiyondegerleri.sagonamortisor, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(1525, 2530));
            g2.DrawString(suspansiyondegerleri.sagonamortisortakozu, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(1525, 2590));
            g2.DrawString(suspansiyondegerleri.sagonsuspansiyonkollari, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(1525, 2660));
            g2.DrawString(suspansiyondegerleri.sagonhelezonyayi, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(1525, 2730));
            g2.DrawString(suspansiyondegerleri.sagarkaamortisor, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(2050, 2530));
            g2.DrawString(suspansiyondegerleri.sagarkaamortisortakozu, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(2050, 2590));
            g2.DrawString(suspansiyondegerleri.sagarkasuspansiyonkollari, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(2050, 2660));
            g2.DrawString(suspansiyondegerleri.sagarkahelezonyayi, new Font("Calibri", 22, FontStyle.Bold), Brushes.Black, new PointF(2050, 2730));
            g2.DrawString(musteridegerleri.aliciadsoyad, new Font("Calibri", 39), Brushes.Black, new PointF(300, 3100));

            SuspansiyonGorsel.Save(musteridegerleri.veriadresi + "\\" + musteridegerleri.barkodno + "suspansiyon.jpg");


            SuspansiyonGorsel.Dispose();
            g2.Dispose();
            b.Dispose();
        }
 public DemoBarcodeLibImpl()
 {
     _barcode = new BarcodeLib.Barcode();
     _barcode.IncludeLabel   = true;
     _barcode.LabelPosition  = BarcodeLib.LabelPositions.BOTTOMCENTER;
     _barcode.RotateFlipType = System.Drawing.RotateFlipType.RotateNoneFlipNone;
     _barcode.Alignment      = BarcodeLib.AlignmentPositions.CENTER;
     _barcode.ForeColor      = System.Drawing.Color.Black;
     _barcode.BackColor      = System.Drawing.Color.White;
 }
Exemple #30
0
        //生成条形码
        public void BuildBar(string Bar)
        {
            BarcodeLib.Barcode b = new BarcodeLib.Barcode();

            BarcodeLib.TYPE type = BarcodeLib.TYPE.CODE128;
            b.IncludeLabel = true;
            System.Drawing.Image image = b.Encode(type, Bar, Color.Black, Color.White, 270, 60);

            pictureBox1.Image = image;
        }
        private Byte[] SalvaCodBarras(string sValor)
        {
            DirectoryInfo dBarras = new DirectoryInfo(Pastas.CBARRAS);
            if (!dBarras.Exists) { dBarras.Create(); }

            BarcodeLib.Barcode barcod = new BarcodeLib.Barcode(sValor, BarcodeLib.TYPE.CODE128C);
            barcod.Encode(BarcodeLib.TYPE.CODE128, sValor, 300, 150);

            string sCaminho = dBarras.ToString() + sValor + ".JPG";

            barcod.SaveImage(@sCaminho, BarcodeLib.SaveTypes.JPG);

            return Util.CarregaImagem(sCaminho);
        }
        protected void OnBtnGenerarClicked(object sender, EventArgs e)
        {
            try {
                BarcodeLib.Barcode codeBar = new BarcodeLib.Barcode ();
                codeBar.IncludeLabel = chkIncludeLabel.Active;

                BarcodeLib.LabelPositions lblPos = (BarcodeLib.LabelPositions)Enum.Parse (typeof(BarcodeLib.LabelPositions), cmbTextPosition.ActiveText.ToString ());
                codeBar.LabelPosition =   lblPos;

                BarcodeLib.TYPE bCodeType = (BarcodeLib.TYPE)Enum.Parse (typeof(BarcodeLib.TYPE), cmbBarCodeType.ActiveText.ToString ());

                int width,height;
                if (int.TryParse(txtWidth.Text.Trim(), out width)){
                    if (int.TryParse(txtHeight.Text.Trim(), out height)){

                        if (!string.IsNullOrEmpty(txtData.Text.Trim())){
                            System.Drawing.Image imgTmpCodeBar = codeBar.Encode (bCodeType, txtData.Text.Trim (), System.Drawing.Color.FromName(cmbColorText.ActiveText) , System.Drawing.Color.FromName(cmbColorBackground.ActiveText), int.Parse(txtWidth.Text.Trim()),int.Parse(txtHeight.Text.Trim()));

                            MemoryStream memoryStream = new MemoryStream();
                            imgTmpCodeBar.Save(memoryStream, ImageFormat.Png);
                            Gdk.Pixbuf pb = new Gdk.Pixbuf (memoryStream.ToArray());

                            imgCodeBar.Pixbuf = pb;
                        } else {
                            txtData.GrabFocus();
                            throw new Exception ("Falta indicar los datos a generar");
                        }
                    } else {
                        txtHeight.GrabFocus();
                        throw new Exception ("Altura incorrecta");
                    }
                } else {
                    txtWidth.GrabFocus();
                    throw new Exception ("Anchura incorrecta");
                }

            } catch (Exception err) {
                MessageDialog dlg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, string.Format ("Ocurrió un error \n {0}", err.Message));
                dlg.Run ();
                dlg.Destroy ();
                dlg.Dispose ();
                dlg = null;
            }
        }
Exemple #33
0
        public static string Generate_Barcode()
        {
            if (str_Barcode == "")
            {
                str_Barcode = Country + Trader + Counter;
            }

            BarcodeLib.Barcode bar = new BarcodeLib.Barcode();
            System.Windows.Forms.PictureBox pb = new System.Windows.Forms.PictureBox();
            bar.IncludeLabel = true;

            bar.RotateFlipType = RotateFlip;
          
            pb.Image = bar.Encode(BarcodeLib.TYPE.CODE128, str_Barcode, Width, Height);


            string str_path = "";

            DataSet ds_Get_Info = FruPak.PF.Data.AccessLayer.CM_System.Get_Info_Like("PF%");
            DataRow dr_Get_Info;
            for (int i = 0; i < Convert.ToInt32(ds_Get_Info.Tables[0].Rows.Count.ToString()); i++)
            {
                dr_Get_Info = ds_Get_Info.Tables[0].Rows[i];
                switch (dr_Get_Info["Code"].ToString())
                {
                    case "PF-TPPath":
                        str_path = dr_Get_Info["Value"].ToString();
                        break;

                }
            }
            ds_Get_Info.Dispose();

            bar.SaveImage(str_path + @"\" + str_Barcode + ".jpg", BarcodeLib.SaveTypes.JPG);

            return str_path + @"\" + str_Barcode + ".jpg";
           
        
        }
Exemple #34
0
 private static Image barcode(string regcode, int width = 300, int height = 50)
 {
     BarcodeLib.Barcode b = new BarcodeLib.Barcode();
     b.Width = width;
     b.Height = height;
     b.Alignment = BarcodeLib.AlignmentPositions.CENTER;
     b.Encode(BarcodeLib.TYPE.CODE128, regcode);
     return b.EncodedImage;
 }
        public static Byte[] SalvaCodBarras(string sValor)
        {
            BarcodeLib.Barcode barcod = new BarcodeLib.Barcode(sValor, BarcodeLib.TYPE.CODE128C);
            barcod.Encode(BarcodeLib.TYPE.CODE128, sValor, 300, 150);

            string sCaminho = "";
            sCaminho = Pastas.CBARRAS + "\\Barras_" + sValor + ".JPG";
            barcod.SaveImage(@sCaminho, BarcodeLib.SaveTypes.JPG);

            return Util.CarregaImagem(sCaminho);
        }
 private System.Drawing.Image generarCodigoBarra(string txt)
 {
     bcode = new BarcodeLib.Barcode();
     System.Drawing.Image im = null;
     switch (etq.TipoCodigoBarra)
     {
         case 39:
             im = bcode.Encode(BarcodeLib.TYPE.CODE39, txt, Color.Black, Color.Transparent);
             break;
         case 128:
             im = bcode.Encode(BarcodeLib.TYPE.CODE128, txt, Color.Black, Color.Transparent);
             break;
         case 0:
             MessageBox.Show("Verifica el tipo de código de barra de la plantilla");
             break;
     }
     return im;
 }
 private Image generarCodigoBarra(string txt)
 {
     bcode = new BarcodeLib.Barcode();
     Image im = null;
     switch (etq.TipoCodigoBarra)
     {
         case 39:
             im = bcode.Encode(BarcodeLib.TYPE.CODE39, txt, Color.Black, Color.Transparent);
             break;
         case 128:
             im = bcode.Encode(BarcodeLib.TYPE.CODE128, txt, Color.Black, Color.Transparent);
             break;
     }
     return im;
 }
        private void btnBARCODE_Click(object sender, EventArgs e)
        {
            BarcodeLib.Barcode barcode = new BarcodeLib.Barcode();

               Image image = barcode.Encode(BarcodeLib.TYPE.CODE128, "0380003562162", Color.Black, Color.White, 300, 150);

               showBarcode.BackgroundImage = barcode.Encode(BarcodeLib.TYPE.CODE128, "0380003562162", Color.Black, Color.White, 300, 50);
               byte[] test = barcode.Encoded_Image_Stream;

               //string test = barcode.EncodedValue;
               dataPrint.Rows.Add(c.NORESI, txtSFROM.Text, txtSTO.Text, txtWEIGHT.Text, txtPCS.Text,
               c.NAMACUSTOMER, txtALAMATPENGIRIM.Text, txtPHONEPENGIRIM.Text, txtPENERIMA.Text, txtALAMAT.Text,
               txtPHONEPENERIMA.Text, lblLAYANAN.Text, txtRATEKIRIM.Text, lblJENISKIRIMAN.Text,
               txtCHARGEINSURANCE.Text, txtCHARGEPPN.Text, txtGRANDTOTAL.Text, txtKETERANGANISI.Text, txtINSTRUKSIKHUSUS.Text, txtPDIM.Text, txtLDIM.Text, txtTDIM.Text, txtHPPENGIRIM.Text, txtCHARGEPACKING.Text, test, barcode.EncodedValue, alamatPerusahaan, telpPerusahaan, faxPerusahaan, c.TGLTERIMA, c.TGLESTIMASI);
            TopMost = false;
            CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            REPORTS.EXPRESS.FormRESIEXPRESS frm = new REPORTS.EXPRESS.FormRESIEXPRESS(dataPrint);
            frm.WindowState = FormWindowState.Normal;
            frm.BringToFront();
            frm.ShowDialog();
        }
 private System.Drawing.Image generarCodigoBarra2(string txt, int w, int h)
 {
     bcode = new BarcodeLib.Barcode();
     System.Drawing.Image im = null;
     switch (etq.TipoCodigoBarra)
     {
         case 39:
             try
             {
                 im = bcode.Encode(BarcodeLib.TYPE.CODE39, txt, Color.Black, Color.Transparent, w, h);
             }
             catch (Exception ex)
             {
                 if (ex.Message.Contains("EGENERATE_IMAGE-2"))//especificar pixeles de largo
                 {
                     int pipeCount = 0;
                     pipeCount = txt.Split('-').Length;
                     switch (pipeCount)
                     {
                         case 2:
                             im = bcode.Encode(BarcodeLib.TYPE.CODE39, txt, Color.Black, Color.Transparent, 1000, 500);
                             break;
                         case 3:
                             im = bcode.Encode(BarcodeLib.TYPE.CODE39, txt, Color.Black, Color.Transparent, 1500, 500);
                             break;
                         case 4:
                             im = bcode.Encode(BarcodeLib.TYPE.CODE39, "VARIOUS", Color.Black, Color.Transparent, 2000, 500);
                             break;
                         default:
                             im = bcode.Encode(BarcodeLib.TYPE.CODE39, "VARIOUS", Color.Black, Color.Transparent, 2000, 500);
                             break;
                     }
                 }
             }
             break;
         case 128:
             im = bcode.Encode(BarcodeLib.TYPE.CODE128, txt, Color.Black, Color.Transparent);
             break;
     }
     return im;
 }
Exemple #40
0
        private Byte[] SalvaCodBarras(string sValor) 
        {
            BarcodeLib.Barcode barcod = new BarcodeLib.Barcode(sValor, BarcodeLib.TYPE.CODE128C);
            barcod.Encode(BarcodeLib.TYPE.CODE128, sValor, 300, 150);
            string sCaminho = "";

            if ((LeRegWin.LeRegConfig("CodBarras") != "\r\n"))
            {
                sCaminho = LeRegWin.LeRegConfig("CodBarras") + "\\Barras_" + sValor + ".JPG";                
            }
            barcod.SaveImage(@sCaminho, BarcodeLib.SaveTypes.JPG);

            return carregaImagem(sCaminho);        
        }