4

私はバーコードのバーコード生成を生成していますバーコードは正常に機能しており、バーコードも完全に読み取ります.followinはバーコード生成のコードです:

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();
}

代替テキスト http://www.freeimagehosting.net/uploads/0e033f305b.png

バーコードの下にあるテキストを削除したいと思います。これどうやってするの?。

4

3 に答える 3

10

Font = null;バーコードの下のテキストを削除するように設定できます。

Barcode128 code128 = new Barcode128();
code128.CodeType = Barcode.CODE128;
code128.Code = "123456789";
code128.Font = null;
于 2011-09-06T10:33:50.443 に答える
6

より良い代替手段は、そもそもテキストを持たないフォントを使用することです:

次のようなものを試してください: 無料のバーコード フォント - Code 39

于 2010-02-11T12:54:25.700 に答える
1

フォントを使用してバーコードを作成しており、バーの下の文字はそのフォントの一部です。

それらを削除する唯一の方法は、テキストをレンダリングした後にビットマップを変更 (またはトリミング) することです。最終的なバーコードの大きさを知る必要があります。不可能ではありませんが、苦痛です。

于 2010-02-11T12:36:13.140 に答える