我生成条形码生成条形码的工作正常条形码也perfectly.followin读它是条码生成代码:从下面的条形码在ASP.NET中删除文本(C#)
private void GenerateBarCode(string codeInfo)
{
//Settings for the Image
string TypeFaceName = "IDAutomationHC39M";
string imageLocation = Server.MapPath("2010.png");
//The format of the image file
ImageFormat format = ImageFormat.Png;
//path of unique file name
string path = "D://MyProjects//RepeaterPaging//images//vijendra.png";
//REFERENCING A FONT
PrivateFontCollection fnts = new PrivateFontCollection();
fnts.AddFontFile("IDAutomationHC39M.ttf");
FontFamily fntfam = new FontFamily(TypeFaceName);
Font fnt = new Font(fntfam, 13);
fnts.AddFontFile("Arial.ttf");
FontFamily fntfam2 = new FontFamily("Arial", fnts);
//DRAWING THE IMAGE
Bitmap bmp = new Bitmap(960, 386); //Canvas size
Graphics g = Graphics.FromImage(bmp);
Bitmap orignBitmap = new Bitmap(imageLocation);
g.Clear(Color.Transparent); //Background color
SizeF bc = g.MeasureString(codeInfo, fnt);
Brush br = new SolidBrush(Color.Black);
g.DrawImage(orignBitmap, 10, 8);
g.DrawString(codeInfo, fnt, br, 585, 170); //Drawing the Image
g.TextRenderingHint=
bmp.Save(path, format); //Saving the Image file
bmp.Dispose(); //Releasing all resources (Image file)
Response.Clear();
}
alt text http://www.freeimagehosting.net/uploads/0e033f305b.png
现在我想删除条形码下方的文字。 我该怎么做?
该代码的输出是什么样的? – 2010-02-11 12:03:25
@Tomas:我的条形码将没有数字(* 50036 *) – Vijjendra 2010-02-11 12:21:43
'orignBitmap'用于什么?是不是从这个图像传来的文字?同样在你的代码中,你正在声明从未使用的'Arial'字体系列。 – 2010-02-11 12:25:00