C# 生成條形碼
上一篇分享了關於二維碼的生成,本篇將分享條形碼。
該方法需要引用 BarcodeLib.dll
鏈接: https://pan.baidu.com/s/1GhEG9-UDa3-2-bSoT62zkA
提取碼: h72q
public static Image CreateBarCode(string content) { using (var barcode = new Barcode() { //true顯示content,false反之 IncludeLabel = true, //content的位置 Alignment = AlignmentPositions.CENTER, //條形碼的寬高 Width = 150, Height = 50, //類型 RotateFlipType = RotateFlipType.RotateNoneFlipNone, //顏色 BackColor = Color.White, ForeColor = Color.Black, }) { return barcode.Encode(TYPE.CODE128B, content); } }