条码code128的C实现

上传人:gui****hi 文档编号:61318653 上传时间:2022-03-11 格式:DOC 页数:5 大小:44.50KB
收藏 版权申诉 举报 下载
条码code128的C实现_第1页
第1页 / 共5页
条码code128的C实现_第2页
第2页 / 共5页
条码code128的C实现_第3页
第3页 / 共5页
资源描述:

《条码code128的C实现》由会员分享,可在线阅读,更多相关《条码code128的C实现(5页珍藏版)》请在装配图网上搜索。

1、使用方法:只需要条用Code128EX的方法public static string GetEncoding(string RawData)即可,RawData为条码字符串,返回为编码值,编码值中的1表示黑线,0表示空白。代码:using System;using System.Collections.Generic;using System.Text;using System.Data;static class Code128EX /code128B的集合 static List m_SetAB = new List , !, , #, $, %, &, , (, ), *, +, , -,

2、 ., /, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, ;, , ?, , A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, , , , , _, , a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, , |, , ; static readonly int m_CodeC = 99; static readonly int m_CodeB = 100; sta

3、tic readonly int m_StartB = 104; static readonly int m_StartC = 105; static readonly int m_Stop = 106; static List m_EncodedSet = new List 11011001100, /0 11001101100, /1 11001100110, /2 10010011000, /3 10010001100, /4 10001001100, /5 10011001000, /6 10011000100, /7 10001100100, /8 11001001000, /9 1

4、1001000100, /10 11000100100, /11 10110011100, /12 10011011100, /13 10011001110, /14 10111001100, /15 10011101100, /16 10011100110, /17 11001110010, /18 11001011100, /19 11001001110, /20 11011100100, /21 11001110100, /22 11101101110, /23 11101001100, /24 11100101100, /25 11100100110, /26 11101100100,

5、 /27 11100110100, /28 11100110010, /29 11011011000, /30 11011000110, /31 11000110110, /32 10100011000, /33 10001011000, /34 10001000110, /35 10110001000, /36 10001101000, /37 10001100010, /38 11010001000, /39 11000101000, /40 11000100010, /41 10110111000, /42 10110001110, /43 10001101110, /44 101110

6、11000, /45 10111000110, /46 10001110110, /47 11101110110, /48 11010001110, /49 11000101110, /50 11011101000, /51 11011100010, /52 11011101110, /53 11101011000, /54 11101000110, /55 11100010110, /56 11101101000, /57 11101100010, /58 11100011010, /59 11101111010, /60 11001000010, /61 11110001010, /62

7、10100110000, /63 10100001100, /64 10010110000, /65 10010000110, /66 10000101100, /67 10000100110, /68 10110010000, /69 10110000100, /70 10011010000, /71 10011000010, /72 10000110100, /73 10000110010, /74 11000010010, /75 11001010000, /76 11110111010, /77 11000010100, /78 10001111010, /79 10100111100

8、, /80 10010111100, /81 10010011110, /82 10111100100, /83 10011110100, /84 10011110010, /85 11110100100, /86 11110010100, /87 11110010010, /88 11011011110, /89 11011110110, /90 11110110110, /91 10101111000, /92 10100011110, /93 10001011110, /94 10111101000, /95 10111100010, /96 11110101000, /97 11110

9、100010, /98 10111011110, /99 10111101110, /100 11101011110, /101 11110101110, /102 11010000100, /103 11010010000, /104 11010011100, /105 1100011101011; /106 public static string GetEncoding(string RawData) List Values = new List(); bool bCodeC=false; /start character if(RawData.Length=2) if (char.Is

10、Digit(RawData, 0) = true & char.IsDigit(RawData, 1) = true) Values.Add(m_StartC); bCodeC = true; if (Values.Count = 0) Values.Add(m_StartB); /encode int head = 0; int tail = 1; while(headRawData.Length) tail = head + 1; /是不是两位数字 if (char.IsDigit(RawData, head) = true) if (tail =2) /2位数字 if(bCodeC=fa

11、lse) Values.Add(m_CodeC); bCodeC = true; Values.Add(Int32.Parse(RawData.Substring(head, 2); else if(bCodeC=true) Values.Add(m_CodeB); bCodeC = false; int index=m_SetAB.IndexOf(RawDatahead); if (index = 0) Values.Add(index); head = tail; /check digit int sum = Values0; for (int i = 1; i Values.Count; i+) sum += Valuesi*i; Values.Add(sum % 103); /out put string EncodedCode = string.Empty; foreach (int i in Values) EncodedCode += m_EncodedSeti; EncodedCode += m_EncodedSetm_Stop; return EncodedCode;

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!