示例#1
0
 public static byte[] GetBarcode(string barcode)
 {
     byte[] btBarcode = new byte[] { };
     if (!string.IsNullOrEmpty(barcode))
     {
         using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
         {
             BarCode128 barCode128 = new BarCode128();
             barCode128.TitleFont   = new System.Drawing.Font("宋体", 10);
             barCode128.HeightImage = 50;
             System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(barcode, barcode, Code.BarCode128.Encode.Code128B);
             bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
             btBarcode = memoryStream.ToArray();
             bitmap.Dispose();
         }
     }
     return(btBarcode);
 }
示例#2
0
 public static byte[] GetBarcode(string barcode)
 {
     byte[] btBarcode = new byte[] { };
     if (!string.IsNullOrEmpty(barcode))
     {
         using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
         {
             BarCode128 barCode128 = new BarCode128();
             barCode128.TitleFont = new System.Drawing.Font("宋体", 10);
             barCode128.HeightImage = 50;
             System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(barcode, barcode, Code.BarCode128.Encode.Code128B);
             bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
             btBarcode = memoryStream.ToArray();
             bitmap.Dispose();
         }
     }
     return btBarcode;
 }