zoukankan      html  css  js  c++  java
  • 条形码 BarCode (C# BarcodeLib.dll)

    1  static  void  BuildBarcode()
    2        {
    3            System.Drawing.Image image;
    4            int width=250, height=100;
    5            byte[] buffer = GetBarcode(height, width, 
    6                     BarcodeLib.TYPE.CODE128, "Avx-(13614)-vR", out image);
    7        }
     1      static byte[] GetBarcode(int height, int width,BarcodeLib.TYPE type,
     2                                           string  code,out System.Drawing.Image image)
     3         {
     4             image=null;
     5             BarcodeLib.Barcode b = new BarcodeLib.Barcode();
     6             b.BackColor = System.Drawing.Color.White;
     7             b.ForeColor = System.Drawing.Color.Black;
     8             b.IncludeLabel = true;
     9             b.Alignment = BarcodeLib.AlignmentPositions.CENTER;
    10             b.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;
    11             b.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
    12             System.Drawing.Font font = new System.Drawing.Font("verdana",10f);
    13             b.LabelFont = font;
    14 
    15             b.Height = height;
    16             b.Width = width;
    17 
    18             image = b.Encode(type, code);
    19             SaveImage(image, Guid.NewGuid().ToString("N")+".png");
    20             byte[] buffer = b.GetImageData(SaveTypes.GIF);
    21             return buffer;
    22         }
    生成的条形码:

    [barcode.dll下载]

  • 相关阅读:
    CodeForces
    CodeForces
    CodeForces 718C && HDU 3572 && Constellation
    CodeForces
    USACO 5.4 tour的dp解法
    10.22~10.28一周经典题目整理(meeting,BZOJ4377,POJ3659)
    codeforces 724D
    codeforces 724C
    hdu5909 Tree Cutting
    hdu5822 color
  • 原文地址:https://www.cnblogs.com/AspDotNetMVC/p/2767576.html
Copyright © 2011-2022 走看看