PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 开发编程 > ASP.NET教程 > 正文

    ASP.NET 生成条形码

    作者:admin来源:B5教程网浏览:时间:2020-09-30 00:07:50我要评论
    导读:ASP NET 生成条形码,给大家分享一下吧。
     
    复制代码代码如下:
    1. #region asp.net 条形码生成
    2.  
    3.  /*
    4.    str = 条形码值
    5.    ch = 条形码高度
    6.    cw = 条形码宽度
    7.    type_code = 是否显示条形码值(1显示)
    8.  */
    9.     public string bar_code(object str, int ch, int cw, int type_code)
    10.     {
    11.         string strTmp = str.ToString();
    12.         string code = strTmp;
    13.         strTmp = strTmp.ToLower();
    14.         int height = ch;
    15.         int width = cw;
    16.         strTmp = strTmp.Replace("0", "_|_|__||_||_|");
    17.         strTmp = strTmp.Replace("1", "_||_|__|_|_||");
    18.         strTmp = strTmp.Replace("2", "_|_||__|_|_||");
    19.         strTmp = strTmp.Replace("3", "_||_||__|_|_|");
    20.         strTmp = strTmp.Replace("4", "_|_|__||_|_||");
    21.         strTmp = strTmp.Replace("5", "_||_|__||_|_|");
    22.         strTmp = strTmp.Replace("7", "_|_|__|_||_||");
    23.         strTmp = strTmp.Replace("6", "_|_||__||_|_|");
    24.         strTmp = strTmp.Replace("8", "_||_|__|_||_|");
    25.         strTmp = strTmp.Replace("a", "_||_|_|__|_||");
    26.         strTmp = strTmp.Replace("b", "_|_||_|__|_||");
    27.         strTmp = strTmp.Replace("c", "_||_||_|__|_|");
    28.         strTmp = strTmp.Replace("d", "_|_|_||__|_||");
    29.         strTmp = strTmp.Replace("e", "_||_|_||__|_|");
    30.         strTmp = strTmp.Replace("f", "_|_||_||__|_|");
    31.         strTmp = strTmp.Replace("g", "_|_|_|__||_||");
    32.         strTmp = strTmp.Replace("h", "_||_|_|__||_|");
    33.         strTmp = strTmp.Replace("i", "_|_||_|__||_|");
    34.         strTmp = strTmp.Replace("j", "_|_|_||__||_|");
    35.         strTmp = strTmp.Replace("k", "_||_|_|_|__||");
    36.         strTmp = strTmp.Replace("l", "_|_||_|_|__||");
    37.         strTmp = strTmp.Replace("m", "_||_||_|_|__|");
    38.         strTmp = strTmp.Replace("n", "_|_|_||_|__||");
    39.         strTmp = strTmp.Replace("o", "_||_|_||_|__|");
    40.         strTmp = strTmp.Replace("p", "_|_||_||_|__|");
    41.         strTmp = strTmp.Replace("r", "_||_|_|_||__|");
    42.         strTmp = strTmp.Replace("q", "_|_|_|_||__||");
    43.         strTmp = strTmp.Replace("s", "_|_||_|_||__|");
    44.         strTmp = strTmp.Replace("t", "_|_|_||_||__|");
    45.         strTmp = strTmp.Replace("u", "_||__|_|_|_||");
    46.         strTmp = strTmp.Replace("v", "_|__||_|_|_||");
    47.         strTmp = strTmp.Replace("w", "_||__||_|_|_|");
    48.         strTmp = strTmp.Replace("x", "_|__|_||_|_||");
    49.         strTmp = strTmp.Replace("y", "_||__|_||_|_|");
    50.         strTmp = strTmp.Replace("z", "_|__||_||_|_|");
    51.         strTmp = strTmp.Replace("-", "_|__|_|_||_||");
    52.         strTmp = strTmp.Replace("*", "_|__|_||_||_|");
    53.         strTmp = strTmp.Replace("/", "_|__|__|_|__|");
    54.         strTmp = strTmp.Replace("%", "_|_|__|__|__|");
    55.         strTmp = strTmp.Replace("+", "_|__|_|__|__|");
    56.         strTmp = strTmp.Replace(".", "_||__|_|_||_|");
    57.         strTmp = strTmp.Replace("_", "");
    58.         strTmp = strTmp.Replace("|", "");
    59.         if (type_code == 1)
    60.         {
    61.             return strTmp + "
      + code;
    62.         }
    63.         else
    64.         {
    65.             return strTmp;
    66.         }
    67.     }
    68.  

    转载请注明(B5教程网)原文链接:https://b5.mxunkeji.com/content-11-198-1.html
    相关热词搜索: 条形码 ASP NET