C # Generate barcode picture, good effect

Source: Internet
Author: User

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 file path public void Createcodebmp (string p_strcode, out string p_strbmpfile) {Crea        Tecodebmp (P_strcode, Out P_strbmpfile, "");        }///p_strbmpfile file path 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;//, default format} try {if (type! = type. UNSPECIFIED) {p_strbmpfile = M_strpath + @ "\" + P_strcode + ".                    Bmp ";                    M_barcoe.includelabel = false; M_barcoe.encode (Type, P_strcode, 359, 150);//Width height m_barcoe.saveimage (p_strbmpfilE, BarcodeLib.SaveTypes.BMP);   }} (Catch {}}}}

  

C # Generate barcode picture, good effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.