C# 生成条形码

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);
            }
        }

 

posted @ 2019-06-04 11:16  AC、搬运工  阅读(7983)  评论(2编辑  收藏  举报