protected void LinkButton1_Click(object sender, EventArgs e) { if (regex.Match(TextBox1.Text).Success) { System.Drawing.Bitmap bc = new System.Drawing.Bitmap(ean.CreateDrawingImage(System.Drawing.Color.Black, System.Drawing.Color.White)); bc.Save(AppPath + @"Files\Barcode\" + FileName + ".gif", System.Drawing.Imaging.ImageFormat.Gif); imgBarCode.ImageUrl = @"Files/Barcode/" + FileName + ".gif"; Label1.Text = TextBox1.Text; Label1.Visible = true; imgBarCode.Visible = true; //LinkButton1.Visible = false; } }
public static Bitmap CodigosBarraUPCA(string _Code, Single Height = 0) { BarcodeEAN uccEan128 = new BarcodeEAN(); uccEan128.CodeType = Barcode.UPCA; if (Height != 0) { uccEan128.BarHeight = 20; } uccEan128.Code = _Code; try { Bitmap bm = new Bitmap(uccEan128.CreateDrawingImage(Color.Black, Color.White)); return(bm); } catch (Exception ex) { throw new Exception("Error al generar el codigo" + ex.ToString()); } }