【转】C#条形码

Code
#region c#条形码
        
public string bar_code(object str, int ch, int cw, int type_code)
        {
            
string strTmp=str.ToString();
            
string code=strTmp;
            strTmp
=strTmp.ToLower();
            
int height=ch;
            
int width=cw;
            strTmp
=strTmp.Replace(0_|_|__||_||_|);;
            strTmp
=strTmp.Replace(1_||_|__|_|_||);
            strTmp
=strTmp.Replace(2_|_||__|_|_||);
            strTmp
=strTmp.Replace(3_||_||__|_|_|);
            strTmp
=strTmp.Replace(4_|_|__||_|_||);
            strTmp
=strTmp.Replace(5_||_|__||_|_|);
            strTmp
=strTmp.Replace(7_|_|__|_||_||);
            strTmp
=strTmp.Replace(6_|_||__||_|_|);
            strTmp
=strTmp.Replace(8_||_|__|_||_|);
            strTmp
=strTmp.Replace(9_|_||__|_||_|);
            strTmp
=strTmp.Replace(a_||_|_|__|_||);
            strTmp
=strTmp.Replace(b_|_||_|__|_||);
            strTmp
=strTmp.Replace(c_||_||_|__|_|);
            strTmp
=strTmp.Replace(d_|_|_||__|_||);
            strTmp
=strTmp.Replace(e_||_|_||__|_|);
            strTmp
=strTmp.Replace(f_|_||_||__|_|);
            strTmp
=strTmp.Replace(g_|_|_|__||_||);
            strTmp
=strTmp.Replace(h_||_|_|__||_|);
            strTmp
=strTmp.Replace(i_|_||_|__||_|);
            strTmp
=strTmp.Replace(j_|_|_||__||_|);
            strTmp
=strTmp.Replace(k_||_|_|_|__||);
            strTmp
=strTmp.Replace(l_|_||_|_|__||);
            strTmp
=strTmp.Replace(m_||_||_|_|__|);
            strTmp
=strTmp.Replace(n_|_|_||_|__||);
            strTmp
=strTmp.Replace(o_||_|_||_|__|);
            strTmp
=strTmp.Replace(p_|_||_||_|__|);
            strTmp
=strTmp.Replace(r_||_|_|_||__|);
            strTmp
=strTmp.Replace(q_|_|_|_||__||);
            strTmp
=strTmp.Replace(s_|_||_|_||__|);
            strTmp
=strTmp.Replace(t_|_|_||_||__|);
            strTmp
=strTmp.Replace(u_||__|_|_|_||);
            strTmp
=strTmp.Replace(v_|__||_|_|_||);
            strTmp
=strTmp.Replace(w_||__||_|_|_|);
            strTmp
=strTmp.Replace(x_|__|_||_|_||);
            strTmp
=strTmp.Replace(y_||__|_||_|_|);
            strTmp
=strTmp.Replace(z_|__||_||_|_|);
            strTmp
=strTmp.Replace(_|__|_|_||_||);
            strTmp
=strTmp.Replace(*_|__|_||_||_|);
            strTmp
=strTmp.Replace(/_|__|__|_|__|);
            strTmp
=strTmp.Replace(%_|_|__|__|__|);
            strTmp
=strTmp.Replace(+_|__|_|__|__|);
            strTmp
=strTmp.Replace(._||__|_|_||_|);
            strTmp
=strTmp.Replace(_<span style=\’height:+height+;width:+width+;background:#FFFFFF;\’></span>);
            strTmp
=strTmp.Replace(|<span style=\’height:+height+;width:+width+;background:#000000;\’></span>);
            
if(type_code==1)
            {
                
return strTmp+<BR>+code;
            }
            
else
            {
                
return strTmp;
            }
        }
        
#endregion

版权声明:本文为niuniu502原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/niuniu502/p/1365507.html