zoukankan      html  css  js  c++  java
  • C# 生成条形码图片,效果不错

    //首先引用 条码库BarcodeLib.dll


    using System; using System.Collections.Generic; using System.Linq; using System.Text; using BarcodeLib; using System.IO; namespace Tool.Gui { public class clsLisBarCode { Barcode m_BarCoe = new Barcode(); string m_strPath; public clsLisBarCode() { m_strPath = System.Windows.Forms.Application.StartupPath + @"Temp"; } ///p_strBMPFile 文件路径 public void CreateCodeBMP(string p_strCode, out string p_strBMPFile) { CreateCodeBMP(p_strCode, out p_strBMPFile, ""); } ///p_strBMPFile 文件路径 public void CreateCodeBMP(string p_strCode, out string p_strBMPFile, string p_strType) { if (!Directory.Exists(m_strPath)) { Directory.CreateDirectory(m_strPath); } try { foreach (string file in Directory.GetFiles(m_strPath)) { File.Delete(file); } } catch { } p_strBMPFile = ""; TYPE type = TYPE.UNSPECIFIED; switch (p_strType) { case "UPCA": type = TYPE.UPCA; break; case "UPC-A (Numbered)": type = TYPE.UPCA; break; case "UPC-E": type = TYPE.UPCE; break; case "UPC 2 Digit Ext.": type = TYPE.UPC_SUPPLEMENTAL_2DIGIT; break; case "UPC 5 Digit Ext.": type = TYPE.UPC_SUPPLEMENTAL_5DIGIT; break; case "EAN13": type = TYPE.EAN13; break; case "JAN13": type = TYPE.JAN13; break; case "EAN8": type = TYPE.EAN8; break; case "ITF14": type = TYPE.ITF14; break; case "Codabar": type = TYPE.Codabar; break; case "PostNet": type = TYPE.PostNet; break; case "Bookland/ISBN": type = TYPE.BOOKLAND; break; case "Code11": type = TYPE.CODE11; break; case "Code39": type = TYPE.CODE39; break; case "Code39 Extended": type = TYPE.CODE39Extended; break; case "Code93": type = TYPE.CODE93; break; case "LOGMARS": type = TYPE.LOGMARS; break; case "MSI": type = TYPE.MSI_Mod10; break; case "Interleaved 2 of 5": type = TYPE.Interleaved2of5; break; case "Standard 2 of 5": type = TYPE.Standard2of5; break; case "Code128": type = TYPE.CODE128; break; case "Code128A": type = TYPE.CODE128A; break; case "Code128B": type = TYPE.CODE128B; break; case "Code128C": type = TYPE.CODE128C; break; default: type = TYPE.CODE128; break;//,默认格式 } try { if (type != TYPE.UNSPECIFIED) { p_strBMPFile = m_strPath + @"" + p_strCode + ".Bmp"; m_BarCoe.IncludeLabel = false; m_BarCoe.Encode(type, p_strCode, 359, 150);//宽度 高度 m_BarCoe.SaveImage(p_strBMPFile, BarcodeLib.SaveTypes.BMP); } } catch { } } } }   

      

  • 相关阅读:
    python 格式化打印
    微软开发工具包下载
    win7 Adobe flash player 无法在线更新
    MySQL5.7本地首次登录win10报错修改
    MySQL本地登录及数据库导入导出
    03蓝桥杯特训课笔记总结:
    03第八届蓝桥杯省赛真题- 2.等差素数列
    02填空题
    01蓝桥杯第七届 方格填数(dfs)
    63中国剩余定理
  • 原文地址:https://www.cnblogs.com/china-guoch/p/4520292.html
Copyright © 2011-2022 走看看