aspgreener的专栏

人生的自由 本人做的小站【小事一箩筐】欢迎访问 http://www.xiaoshiyiluokuang.com

用户操作
[即时聊天] [发私信] [加为好友]
水若寒ID:aspgreener
48645次访问,排名2376,好友100人,关注者105人。
电脑,购物,旅游,美食,网游,文学,影视,游泳,娱乐,IT技术,IT,music,电影,音乐,读书,流行音乐
aspgreener的文章
原创 81 篇
翻译 1 篇
转载 155 篇
评论 58 篇
aspgreener的公告
小事一箩筐,让你笑翻了^_^
箩筐.Net采集器


希望大家一起学习进步,有什么问题请与我联系。Msn:nnu_zyj@hotmail.com QQ:49940396

统计:

最近评论
zhengguangyi130:顶..太有意思了...哈哈
l8x88b:倒晕
不好意思啊!
一发就是两个出来
l8x88b:倒晕
不好意思啊!
一发就是两个出来
l8x88b:Print2Flash控件
这个控件您用过吗?哪有,我找了下没找到
谢谢!
l8x88b:Print2Flash控件
这个控件您用过吗?哪有,我找了下没找到
谢谢!
文章分类
收藏
相册
存档
软件项目交易
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes

转载 asp.net(c#)生成条形码 收藏

新一篇: C#如何打印条形码EAN13码  | 旧一篇: sql server 2005 可视化管理工具

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    
protected void Page_Load(object sender, EventArgs e)
    
{
        Response.Write(bar_code(
"www.sosuo8.com"10012));
    }

    
public string bar_code(object str, int ch, int cw, int type_code)
    
{
        
//str:输入的字符串;ch:要显示条形码的高度;cw:要显示条形码的宽度;type_code:代码类型
        string strTmp = str.ToString();
        
string code = strTmp;
        
// ToLower()将string转化成小写形式的副本,返回是使用指定区域的性的大小写规则。
        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;
        }

    }
   
}


 
 

发表于 @ 2007年09月04日 09:59:00|评论(loading...)|编辑

新一篇: C#如何打印条形码EAN13码  | 旧一篇: sql server 2005 可视化管理工具

评论

#up 发表于2008-08-21 08:31:47  IP: 122.236.147.*
up一个
#up 发表于2008-08-21 08:39:17  IP: 122.236.147.*
up一个
发表评论  


登录
Csdn Blog version 3.1a
Copyright © aspgreener