惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
H
Help Net Security
Last Week in AI
Last Week in AI
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
B
Blog
C
Check Point Blog
T
Tailwind CSS Blog
云风的 BLOG
云风的 BLOG
D
Docker
Recent Announcements
Recent Announcements
Vercel News
Vercel News
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
月光博客
月光博客
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
The Register - Security
The Register - Security
V
Visual Studio Blog
F
Full Disclosure
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
Latest news
Latest news
PCI Perspectives
PCI Perspectives
Cisco Talos Blog
Cisco Talos Blog
博客园 - Franky
D
DataBreaches.Net
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
P
Palo Alto Networks Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
T
Tenable Blog
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy

博客园 - 星空竹月

Div中文字竖直居中的问题 ASP入门基础教程-VBScript概述及基本元素 第一次安装sql2000挂起无法安装的问题 关于文章列表如何直接显示文章类别名的问题 Page_PreInit在网页传值的应用 利用.net的强大功能发送email - 星空竹月 - 博客园 在页面和Datalist控件中判断是否为今天 - 星空竹月 - 博客园 如何在asp.net中关闭B页面时,自动刷新A页面? - 星空竹月 - 博客园 ASP.net(c#)做返回上一页效果(后退)--代码 前进和后退按钮特效代码 - 星空竹月 - 博客园 文件上传实例(文件上传,自动重命名,自动添加文件夹) ASP.NET中文显示乱码之解决方法 限制显示字数 asp.net中,限制显示字数的问题? 将截断字符串或二进制数据。 IE6下透明PNG图片的显示 IE不支持PNG图片透明效果,怎么办 配置AjaxControlToolkit 怎样换网页中的鼠标图案??换成其他图片
asp.net(c#)成条形码[转]
星空竹月 · 2007-09-22 · via 博客园 - 星空竹月

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;
        }

    }
   
}


 

 

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1771298