what is the barcode image for number(0,1,2,3,4,5,6,7,8,9)
if i enter number to the text box the correct bar code is display.........
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Mar 26, 2011, 3:51 PM
FroglegPosted Mar 26, 2011, 3:30 PM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BarcodeGen
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private Bitmap CreateBarcode(string data)
{
Bitmap barcode = new Bitmap(1, 1);
Font threeOfNine = new Font("Free 3 of 9", 60, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
Graphics graphics = Graphics.FromImage(barcode);
SizeF dataSize = graphics.MeasureString(data, threeOfNine);
barcode = new Bitmap(barcode,dataSize.ToSize());
graphics = Graphics.FromImage(barcode);
graphics.Clear(Color.White);
graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
graphics.DrawString(data,threeOfNine,new SolidBrush(Color.Black),0,0);
graphics.Flush();
threeOfNine.Dispose();
graphics.Dispose();
return barcode;
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image = CreateBarcode(textBox1.Text);
}
}
}
FroglegPosted Mar 26, 2011, 3:10 PM
http://www.techrepublic.com/blog/howdoi/how-do-i-generate-barcodes-using-c/173