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;
            }
  • 相关阅读:
    2190 ACM 数学概率论的乘法和加法原则
    2186 ACM 水题 int 向下取整
    2110 ACM Crisis of HDU 母函数
    2079 ACM 选课时间 背包 或 母函数
    2111 ACM 贪心 水题
    2108 ACM 向量积 凹凸
    My Web Developer Roadmap
    2109 ACM 排序
    2107 ACM 水题
    vi的常用命令
  • 原文地址:https://www.cnblogs.com/90nice/p/3724622.html
Copyright © 2011-2022 走看看