国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

.NET條形碼

2019-11-17 02:08:04
字體:
供稿:網(wǎng)友

.NET條形碼

建議不要用CODE-39碼,改用CODE-128碼;

CODE-39碼密度比較低,條碼數(shù)字內(nèi)容太多,導(dǎo)致條碼太長,縮短長度就只能減小X尺寸,造成識讀困難;

CODE-128碼密度高,相同的數(shù)字生成條碼更短。

你可以對比一下圖中的兩個條碼,上面是CODE-39,下面是CODE-128,相同的內(nèi)容:

解決方案:

Default.aspx

%201%20<%@%20Page%20Language="C#"%20AutoEventWireup="true"%20CodeBehind="Default.aspx.cs"%20Inherits="BarcodeTest.Default"%20%>%202%20%203%20<!DOCTYPE%20html>%204%20%205%20<html%20xmlns="http://www.w3.org/1999/xhtml">%206%20<head%20runat="server">%207%20%20%20%20%20<meta%20http-equiv="Content-Type"%20content="text/html;%20charset=utf-8"%20/>%208%20%20%20%20%20<title>條形碼</title>%209%20%20%20%20%20<scr

CharacterSet.cs

 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5  6 //author: Kenmu 7 //created by: 2014-11-05 8 //function: 條形碼 9 namespace Barcode10 {11     /// <summary>  12     /// Code128字符集  13     /// </summary>  14     internal enum CharacterSet15     {16         A,17         B,18         C19     } 20 }

IBarCode.cs

 1 using System; 2 using System.Collections.Generic; 3 using System.Drawing; 4 using System.Linq; 5 using System.Text; 6  7 //author: Kenmu 8 //created by: 2014-11-05 9 //function: 條形碼10 namespace Barcode11 {12     /// <summary>  13     /// 條形碼接口  14     /// </summary> 15     public interface IBarCode16     {17         string RawData { get; }18         /// <summary>  19         /// 條形碼對應(yīng)的數(shù)據(jù)  20         /// </summary>  21         string EncodedData { get; }22         /// <summary>  23         /// 當(dāng)前條形碼標(biāo)準(zhǔn)  24         /// </summary>  25         string BarCodeType { get; }26 27         /// <summary>  28         /// 得到條形碼對應(yīng)的圖片  29         /// </summary>  30         /// <returns></returns>  31         Image GetBarCodeImage();32     }33 }

BaseCode128.cs

  1 using System;  2 using System.Collections.Generic;  3 using System.Linq;  4 using System.Text;  5 using System.Drawing;  6   7 //author: Kenmu  8 //created by: 2014-11-06  9 //function: 條形碼 10 namespace Barcode 11 { 12     /// <summary>   13     /// BaseCode128抽象類   14     /// </summary>   15     public abstract class BaseCode128 : IBarCode 16     { 17         protected Color backColor = Color.White;//條碼背景色   18         protected Color barColor = Color.Black;//條碼和原始數(shù)據(jù)字體顏色 19          20         /// <summary>   21         /// 當(dāng)前條形碼種類 22         /// </summary>   23         public string BarCodeType 24         { 25             get { return System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name; } 26         } 27  28         /// <summary>   29         /// 條形碼對應(yīng)的編碼數(shù)據(jù)   30         /// </summary> 31         protected string _EncodedData; 32         public string EncodedData 33         { 34             get { return this._EncodedData; } 35         } 36  37         /// <summary>   38         /// 【原始數(shù)據(jù)】 39         /// </summary> 40         protected string _RawData; 41         public string RawData 42         { 43             get { return this._RawData; } 44         } 45  46         /// <summary>   47         /// 在條形碼下面顯示數(shù)據(jù);如果為空,則取【原始數(shù)據(jù)】   48         /// </summary> 49         protected string _PresentationData = null; 50         public string PresentationData 51         { 52             get { return string.IsNullOrEmpty(this._PresentationData) ? this._RawData : this._Present
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 广安市| 平凉市| 呼和浩特市| 平度市| 元江| 赤城县| 北川| 张家口市| 仁化县| 遵化市| 长子县| 浠水县| 邓州市| 大同市| 班玛县| 大姚县| 雅安市| 南丹县| 宁晋县| 杭锦后旗| 丹东市| 杂多县| 库车县| 巴南区| 常宁市| 泸水县| 承德县| 策勒县| 保山市| 嘉禾县| 望都县| 安福县| 万全县| 布尔津县| 德化县| 新巴尔虎左旗| 中宁县| 凉山| 胶州市| 清水河县| 读书|