zoukankan      html  css  js  c++  java
  • asp.net 条码 一维条码 生成, 一共有32中格式类型

    想用asp.net 实现条码功能,网上找了代码都不全。

    终于找到了一个非常全的DLL 是winForm的,原以为不能用在WEB 上结果 可以使用。

    首先,引用 DLL 不必说了,下面是 使用设置。还有很多设置 参数,自己琢磨咯。

    DLL下载地址  http://pan.baidu.com/s/1jGfwcVc 

    示例代码: http://pan.baidu.com/s/1kT7etvD (WinForm版)

    下图为 ASP.NET 示例代码:

    public ActionResult Test() 
            {
                var bar = new Cobainsoft.Windows.Forms.BarcodeControl();
                bar.AddOnCaption = null;
                bar.AddOnData = null;
                bar.BackColor = System.Drawing.Color.White;
                bar.BarcodeType = Cobainsoft.Windows.Forms.BarcodeType.CODE39;
                bar.Font = new System.Drawing.Font("Arial", 9F);
                bar.ForeColor = System.Drawing.Color.Black;
                bar.HorizontalAlignment = Cobainsoft.Windows.Forms.BarcodeHorizontalAlignment.Center;
                bar.InvalidDataAction = Cobainsoft.Windows.Forms.InvalidDataAction.DisplayInvalid;
                bar.Location = new System.Drawing.Point(3, 3);
                bar.LowerTopTextBy = 0F;
                bar.RaiseBottomTextBy = 0F;
                bar.Size = new System.Drawing.Size(218, 69);
    
    
    
                bar.BarcodeType = Cobainsoft.Windows.Forms.BarcodeType.CODE128C;// 枚举 根据什么格式生成
                bar.ShowCode39StartStop = true;// code39是否有星号
                bar.Data = "88808411"; // 条码数据
                bar.AddOnData = "";// 日期
                bar.TextPosition = Cobainsoft.Windows.Forms.BarcodeTextPosition.Below; // 数据显示在条码底部
                bar.StretchText = true;
                bar.CopyRight = "cydiy";
                
                bar.Invalidate();
                //Stream stream = new FileStream("D://100.png", FileMode.Create, FileAccess.Write, FileShare.None);
                //bar.MakeImage(System.Drawing.Imaging.ImageFormat.Png, 1, 50, true, false, null, stream);
                bar.SaveImage(System.Drawing.Imaging.ImageFormat.Png, 2, 60, true, false, null, "D://1.png");
    
                return null;
            }
  • 相关阅读:
    使用httperrequest,模拟发送及接收Json请求
    VI/VIM 常用命令
    Robot Framework开发系统关键字详细
    Python logging模块使用记录
    反编译app方法
    python+appium使用记录
    查看apk包及Activity名方法
    Robot Framework使用技巧
    git 常用使用及问题记录
    多个git账户生成多份rsa秘钥实现多个账户同时使用配置
  • 原文地址:https://www.cnblogs.com/90nice/p/3724622.html
Copyright © 2011-2022 走看看