how can i create an Image Object with a string or barcode

  • Thread starter Thread starter Mullin Yu
  • Start date Start date
M

Mullin Yu

now, i want to create a Image object, which is a white rectangle with a
specific size of area, and a black string or barcode will be on it.

any api or sample code or ideas?

thanks!
 
Hi,

System.Drawing.SizeF lobjRegion =
this.CreateGraphics().MeasureString(myTEXTCOMES HERE, this.Font);
Bitmap lobjBitmap = new
Bitmap(System.Convert.ToInt32(lobjRegion.Width)+1,this.Font.Height+2);
Graphics lobjGraphic = Graphics.FromImage(lobjBitmap);
SolidBrush lobjBrush = new SolidBrush(Color.LightYellow);
lobjGraphic.DrawRectangle(new
Pen(Color.Black),0,0,lobjRegion.Width,lobjRegion.Height);
lobjGraphic.FillRectangle(lobjBrush,1,1,lobjRegion.Width-2,lobjRegion.Height
-1);
lobjGraphic.DrawString (myTEXTCOMES HERE, this.Font,
Brushes.Black,System.Drawing.RectangleF.Empty,StringFormat.GenericDefault);


Nirosh
 
Mullin Yu said:
now, i want to create a Image object, which is a white rectangle with a
specific size of area, and a black string or barcode will be on it.

any api or sample code or ideas?

thanks!

I would suggest using a barcode font - take a look at
www.morovia.com/font/ if you do not know them. Easy, simple and
covenient.
 
Back
Top