private void button1_Click(object sender, EventArgs e) { BaseBarcode b = BarcodeFactory.GetBarcode(Symbology.I2of5); b.Number = "123456789"; b.ChecksumAdd = true; b.Rotation = RotationType.Degrees90; pictureBox1.Image = b.Render(); }
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { this.barcodeControl1.Render(e.Graphics, 100, 100); BaseBarcode b = BarcodeFactory.GetBarcode(Symbology.I2of5); b.Number = "123456789"; b.ChecksumAdd = true; b.Rotation = RotationType.Degrees90; // 92 dots per inch (screen resolution) * 1.5 cm /2.54 inch b.Height = (int)(92.0F * 1.5 / 2.54); // 1.5 cm b.NarrowBarWidth = (int)(92.0F * 0.05 / 2.54); // 0.5 mm b.Render(e.Graphics, 300, 100); }
private void buttonGenerate_Click(object sender, EventArgs e) { BaseBarcode barcode = BarcodeFactory.GetBarcode(Symbology.EAN13); barcode.Number = tbEan.Text; if (cbControlSum.Checked == true) { barcode.ChecksumAdd = true; } else { barcode.ChecksumAdd = false; } pbBarCode.Image = barcode.Render(); barcode.Save("barcode.png", ImageType.Png); }
private void Generate_Click(object sender, EventArgs e) { BaseBarcode barcode = BarcodeFactory.GetBarcode(Symbology.EAN13); barcode.Number = textBoxEAN.Text; if (checkBoxSumCtrl.Checked) { barcode.ChecksumAdd = true; } else { barcode.ChecksumAdd = false; } pictureBoxBarcode.Image = barcode.Render(); barcode.Save("barcode.png", ImageType.Png); }
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.PageUnit = GraphicsUnit.Pixel; BaseBarcode b = BarcodeFactory.GetBarcode(Symbology.I2of5); b.Number = "123456789"; b.ChecksumAdd = true; b.Rotation = RotationType.Degrees90; b.Height = CentimetersToPixels(2.5, e.Graphics.DpiY); // 2.5 cm b.NarrowBarWidth = CentimetersToPixels(0.05, e.Graphics.DpiX); // 0.05 cm = 0.5 mm b.Render(e.Graphics, CentimetersToPixels(1.0, e.Graphics.DpiX), CentimetersToPixels(1.0, e.Graphics.DpiY)); }