• C# 生成条形码


    原文地址:http://www.cnblogs.com/xcsn/p/4514759.html

    引用BarcodeLib.dll(百度云中有)生成条形 protected void Button2_Click(object sender, EventArgs e)//点击button2,生成条形码。

            {
                System.Drawing.Image image;
                int width = 148, height = 55;
                string fileSavePath = AppDomain.CurrentDomain.BaseDirectory + "BarcodePattern.jpg";
                if (File.Exists(fileSavePath))
                    File.Delete(fileSavePath);
                GetBarcode(height, width, BarcodeLib.TYPE.CODE128, "20131025-136", out image, fileSavePath);  
                //"20131025-136"是条形码的内容,fileSavePath是条形码保存的位置。
            }
    public static void GetBarcode(int height, int width, BarcodeLib.TYPE type, string code, out System.Drawing.Image image, string fileSaveUrl)
    {
    image = null;
    BarcodeLib.Barcode b = new BarcodeLib.Barcode();
    b.BackColor = System.Drawing.Color.White;
    b.ForeColor = System.Drawing.Color.Black;
    b.IncludeLabel = true;
    b.Alignment = BarcodeLib.AlignmentPositions.CENTER;
    b.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;
    b.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
    System.Drawing.Font font = new System.Drawing.Font("verdana", 10f);
    b.LabelFont = font;
    b.Height = height;
    b.Width = width;
    image = b.Encode(type, code);
    image.Save(fileSaveUrl, System.Drawing.Imaging.ImageFormat.Png);
    }
  • 相关阅读:
    javascript --学习this
    seaJS
    wamp之htaccess的配置
    replace之$1、$2等
    nw.js使用
    新电脑开发环境配置
    vue-vue常用指令
    Array的splice与slice
    vue-入门体验
    Object.defineProperty
  • 原文地址:https://www.cnblogs.com/vichin/p/5971489.html
Copyright © 2020-2023  润新知