close

1.前言:
要利用程式撰寫Barcode需要深入了解條碼的規格定義,編碼規則,才能進行Coding,本範例介紹使用BarcodeLib可以輕鬆完成一維條碼標籤的製作,

2.說明:
BarcodeLib下載:
http://www.codeproject.com/Articles/20823/Barcode-Image-Generation-Library

將軟體下載後解壓縮,在Barcode_bin目錄下複製BarcodeLib.dll到自己的專案bin目錄下。

BarcodeLib可支援的條碼規格如以下列表:
-- Code 128
-- Code11
-- Code 39 (Extended / Full ASCII)
-- Code 93
-- EAN-8
-- EAN-13
-- UPC-A
-- UPC-E
-- JAN-13
-- MSI
-- ISBN
-- Standard 2 of 5
-- Interleaved 2 of 5
-- PostNet
-- UPC Supplemental 2
-- UPC Supplemental 5
-- Codabar
-- ITF-14
-- Telepen  
-- FIM (Facing Identification Mark)

加入參考:

BarcodeLib.dll

加入命名空間:

using BarcodeLib;

程式碼:

//Barcode實例化
Barcode bc = new Barcode();
bc.IncludeLabel = true;//是否顯示標籤Label
bc.LabelFont = new Font("Verdana", 8f);//標籤字型與大小
bc.Width = 300;//標籤寬度
bc.Height = 150;//標籤高度
//編碼產生影像
Image img = bc.Encode(TYPE.CODE128, "PIXNET", bc.Width, bc.Height);
pictureBox1.Image = img;

圖例:

barcodelib  

arrow
arrow
    文章標籤
    C# Barcode 一維條碼
    全站熱搜

    西夏普 發表在 痞客邦 留言(0) 人氣()