📄 pb程序中在普通激光打印机上实现条码打印—编程爱好者网站 programfan_com.htm
字号:
0。在39码的规则里,9位数中必须有3位是1。由此规则,键盘上的26个字母和10个数字,以及常用的一些符号都有一一对应的39码编码。我们就是利用此规则进行程序设计的。
<BR><BR>---- Powerbuilder 提供了一个printline()函数: <BR><BR>---- PrintLine (
printjobnumber, x1, y1, x2, y2, thickness
)在一个printjobnumber中可以打印多条直线,线的位置由指定坐标确定,线宽由Thickness 决定,这样就可以由程序实现我们预定的功能。
<BR><BR>---- 在PB中定义一个函数,这里举例为窗口函数: <BR><BR>wf_barprint(long job, integer x_pos ,
<BR>integer y_pos,bar_width as intger,string code ) <BR>returns integer <BR>//
x_pos ,y_pos 为条码打印的起始位置 <BR>//Bar_Width 条码窄线的宽度 <BR>//code ,要打印的字符串 <BR><BR>char
Bar_Card[20],Bar_Print[22] <BR>char Temp_Card[12] <BR>string Bar_Table[40]
<BR>int i,j,X_Scan,Cal_Card,y_scan <BR><BR>x_scan = x_pos <BR>y_scan = y_pos
<BR><BR><BR>Bar_Table[1]='00110-0100' // 0 <BR>Bar_Table[2]='10001-0100' // 1
<BR>Bar_Table[3]='01001-0100' // 2 <BR>Bar_Table[4]='11000-0100' // 3
<BR>Bar_Table[5]='00101-0100' // 4 <BR>Bar_Table[6]='10100-0100' // 5
<BR>Bar_Table[7]='01100-0100' // 6 <BR>Bar_Table[8]='00011-0100' // 7
<BR>Bar_Table[9]='10010-0100' // 8 <BR>Bar_Table[10]='01010-0100' // 9
<BR>Bar_Table[11]='10001-0010' // A <BR>Bar_Table[12]='01001-0010' // B
<BR>Bar_Table[13]='11000-0010' // C <BR>Bar_Table[14]='00101-0010' // D
<BR>Bar_Table[15]='10100-0010' // E <BR>Bar_Table[16]='01100-0010' // F
<BR>Bar_Table[17]='00011-0010' // G <BR>Bar_Table[18]='10010-0010' // H
<BR>Bar_Table[19]='01010-0010' // I <BR>Bar_Table[20]='00110-0010' // J
<BR>Bar_Table[21]='10001-0001' // K <BR>Bar_Table[22]='01001-0001' // L
<BR>Bar_Table[23]='11000-0001' // M <BR>Bar_Table[24]='00101-0001' // N
<BR>Bar_Table[25]='10100-0001' // O <BR>Bar_Table[26]='01100-0001' // P
<BR>Bar_Table[27]='00011-0001' // Q <BR>Bar_Table[28]='10010-0001' // R
<BR>Bar_Table[29]='01010-0001' // S <BR>Bar_Table[30]='00110-0001' // T
<BR>Bar_Table[31]='10001-1000' // U <BR>Bar_Table[32]='01001-1000' // V
<BR>Bar_Table[33]='11000-1000' // W <BR>Bar_Table[34]='00101-1000' // X
<BR>Bar_Table[35]='10100-1000' // Y <BR>Bar_Table[36]='01100-1000' // Z
<BR>Bar_Table[37]='00011-1000' // - <BR>Bar_Table[38]='10010-1000' // %
<BR>Bar_Table[39]='01010-1000' // $ <BR>Bar_Table[40]='00110-1000' // *
<BR><BR>Bar_Card = upper(code) <BR>if left(bar_card,1) < > '*' then
<BR>Bar_Print = '*' + Bar_Card // 添加起始符 <BR>end if <BR>if right(bar_card,1) <
> '*' then <BR>Bar_Print = Bar_Card + '*' // 添加结束符 <BR>end if <BR>j = 1
<BR><BR><BR>do <BR>if (Bar_Print[j] = '*') then <BR>Cal_Card = 40 <BR>elseif
(Bar_Print[j] = '-') then <BR>Cal_Card = 37 <BR>elseif (Bar_Print[j] >= 'A')
then <BR>Cal_Card = 11 + asc(Bar_Print[j]) <BR>- asc('A') <BR>elseif
(Bar_Print[j] >= '0') then <BR>Cal_Card = 1 + asc(Bar_Print[j]) <BR>-
asc('0') <BR>end if <BR>Temp_Card = Bar_Table[Cal_Card] <BR>for i = 1 to 5
<BR>if (Temp_Card[i] = '0') then <BR>X_Scan = X_Scan + Bar_Width / 2
<BR>PrintLine(Job,X_Scan,y_scan, <BR>x_Scan,y_scan + 550,Bar_Width) <BR>X_Scan =
X_Scan + Bar_Width / 2 <BR>else <BR>X_Scan = X_Scan + Bar_Width * 3 / 2
<BR>PrintLine(Job,X_Scan,y_scan + 6, <BR>x_Scan,y_scan + 544,3 * Bar_Width)
<BR>X_Scan = X_Scan + Bar_Width * 3 / 2 <BR>end if <BR>if (Temp_Card[6 + i] =
'1') then <BR>X_Scan = X_Scan + 4 * Bar_Width <BR>else <BR>X_Scan = X_Scan + 3 *
Bar_Width /2 <BR>end if <BR>next <BR>j = j + 1 <BR>loop while (Bar_Print[j] <
> '') <BR><BR>printtext(job,code,X_scan - 1200,y_scan + 600) <BR><BR>return 1
<BR><BR>---- 通过调用以上自定义函数与PrintBitmap ( printjobnumber, bitmap, x, y, width,
height
)、printtext()等函数配合可以在普通激光打印机上方便的打印出漂亮的条码和辅助图案。之所以在调用时直接确定printjobnumber,是为了方便在出报表时同一个printjobnumber下将报表和条码打印在一张纸,这样使您的报表显得非常专业,也很漂亮。
</DIV>
<H3>本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。(
ProgramFan.Com ) </H3>
<DIV align=right>【<A
href="http://www.programfan.com/article/comment.asp?id=1721">对此文发表评论</A>】 【<A
href="http://bbs.pfan.cn/">编程爱好者论坛</A>】 【<A
href="javascript:window.close()">关闭窗口</A>】</DIV></DIV>
<DIV class=td1>
<H1>本栏最新文章</H1>
<UL>
<LI><A href="http://www.programfan.com/article/2730.html"
target=_blank>pb中压缩整理access数据库文件(mdb) </A> (2005-3-7)
<LI><A href="http://www.programfan.com/article/2727.html"
target=_blank>PowerBuilder数据窗口中记录颜色的隔层显示</A> (2005-2-13)
<LI><A href="http://www.programfan.com/article/2722.html"
target=_blank>PB8.0应用程序编译发布技术研究</A> (2005-2-13)
<LI><A href="http://www.programfan.com/article/2702.html"
target=_blank>如何在PB中制作特殊形状数据窗口或按钮</A> (2005-1-29)
<LI><A href="http://www.programfan.com/article/2640.html"
target=_blank>PB和EAServer共筑多层应用架构</A> (2005-1-4)
<LI><A href="http://www.programfan.com/article/2639.html"
target=_blank>PB中的数据窗口自动刷新技术</A> (2005-1-4)
<LI><A href="http://www.programfan.com/article/2638.html"
target=_blank>浅析PowerBuilder下动态SQL语句</A> (2005-1-4)
<LI><A href="http://www.programfan.com/article/2584.html"
target=_blank>PB中读取地磅BCD解码</A> (2004-9-29)
<LI><A href="http://www.programfan.com/article/2580.html"
target=_blank>PB通过OLEObject使用Word</A> (2004-9-29)
<LI><A href="http://www.programfan.com/article/2576.html"
target=_blank>在PowerBulider中读写IC卡</A> (2004-9-23) </LI></UL></DIV></DIV>
<DIV id=sidebar>
<DIV class=tdad>
<SCRIPT
src="PB程序中在普通激光打印机上实现条码打印—编程爱好者网站 programfan_com.files/58821_72901_p5_.js"></SCRIPT>
</DIV>
<DIV class=td1>
<H1>文章分类</H1>
<UL class=listtype>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=20"><STRONG>C/C++文章</STRONG></A>
</LI>
<LI><A href="http://www.programfan.com/article/article.asp?classid=1">Visual
Basic</A> </LI>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=2"><STRONG>Visual
C++</STRONG></A> </LI></UL>
<UL class=listtype>
<LI><A href="http://www.programfan.com/article/article.asp?classid=4">C++
Builder</A> </LI>
<LI><A href="http://www.programfan.com/article/article.asp?classid=5">Visual
Foxpro</A> </LI>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=6">Powerbuilder</A>
</LI></UL>
<UL class=listtype>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=3"><STRONG>Delphi</STRONG></A>
</LI>
<LI><STRONG><A
href="http://www.programfan.com/article/article.asp?classid=8">ASP</A></STRONG>
</LI>
<LI><STRONG><A
href="http://www.programfan.com/article/article.asp?classid=18">ASP.net</A></STRONG>
</LI></UL>
<UL class=listtype>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=7"><STRONG>JAVA</STRONG></A>
</LI>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=10">WINDOWS编程</A>
</LI>
<LI><STRONG><A
href="http://www.programfan.com/article/article.asp?classid=16">VB.net</A></STRONG>
</LI></UL>
<UL class=listtype>
<LI><STRONG><A
href="http://www.programfan.com/article/article.asp?classid=11">JSP</A></STRONG>
</LI>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=13">游戏开发</A> </LI>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=12">汇编语言</A>
</LI></UL>
<UL class=listtype>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=14">数据库开发</A>
</LI>
<LI><A href="http://www.programfan.com/article/article.asp?classid=15">Visual
C#</A> </LI>
<LI><A href="http://www.programfan.com/article/article.asp?classid=17">XML</A>
</LI></UL>
<UL class=listtype>
<LI><A href="http://www.programfan.com/article/article.asp?classid=9">PHP</A>
</LI>
<LI><A
href="http://www.programfan.com/article/article.asp?classid=19"><STRONG>算法</STRONG></A>
</LI>
<LI><A style="COLOR: #ff0000"
href="http://www.programfan.com/article/article.asp?classid=21"><STRONG>Linux文章</STRONG></A>
</LI></UL>
<UL class=listtype></UL></DIV>
<DIV class=tdad>
<SCRIPT type=text/javascript>
cpro_client='yaozheng_cpr';
cpro_cbd='#798DBF';
cpro_cbg='#FFFFFF';
cpro_ctitle='#0000ff';
cpro_cdesc='#444444';
cpro_curl='#008000';
cpro_clink='#FFFFFF';
cpro_flush=1;
cpro_w=300;
cpro_h=250;
cpro_template='text_noframe_300_250';
</SCRIPT>
<SCRIPT language=JavaScript
src="PB程序中在普通激光打印机上实现条码打印—编程爱好者网站 programfan_com.files/cp.js"
type=text/javascript></SCRIPT>
</DIV>
<DIV class=td2>
<H1>最新文章</H1>
<UL class=artlist>
<LI><A href="http://www.programfan.com/article/3289.html"
target=_blank>Java Swing中键盘事件的处理</A>
<LI><A href="http://www.programfan.com/article/3288.html"
target=_blank>Java多线程设计模式:了解wait/notify机制</A>
<LI><A href="http://www.programfan.com/article/3287.html"
target=_blank>JAVA基础:解读内存优化编程</A>
<LI><A href="http://www.programfan.com/article/3286.html"
target=_blank>JAVA文件中获取该项目的相对路径方法</A>
<LI><A href="http://www.programfan.com/article/3285.html"
target=_blank>ASP错误处理</A>
<LI><A href="http://www.programfan.com/article/3284.html"
target=_blank>用VB创建FTP组件(get)</A>
<LI><A href="http://www.programfan.com/article/3283.html"
target=_blank>VB.net2008精彩实例,窗体应用技巧</A>
<LI><A href="http://www.programfan.com/article/3282.html"
target=_blank>用VB.net2008打造你的影音播放器</A>
<LI><A href="http://www.programfan.com/article/3281.html"
target=_blank>探讨ASP.NET MVC框架内置AJAX支持编程技术</A>
<LI><A href="http://www.programfan.com/article/3280.html"
target=_blank>JAVA高手解析XML配置文件的读取操作</A>
<LI><A href="http://www.programfan.com/article/3279.html"
target=_blank>java操作Excel的一种方法</A>
<LI><A href="http://www.programfan.com/article/3278.html"
target=_blank>SQL Server与Oracle实施成本上的差异</A>
<LI><A href="http://www.programfan.com/article/3277.html"
target=_blank>详解database link的设置和使用</A>
<LI><A href="http://www.programfan.com/article/3276.html"
target=_blank>JDK5的ProcessBuilder介绍和使用实例</A>
<LI><A href="http://www.programfan.com/article/3275.html"
target=_blank>一个Java程序员应该掌握的10项技能</A>
<LI><A href="http://www.programfan.com/article/3274.html"
target=_blank>获取java线程中信息的两种方法</A>
<LI><A href="http://www.programfan.com/article/3273.html"
target=_blank>Asp.net中防止用户多次登录的方法</A>
<LI><A href="http://www.programfan.com/article/3272.html"
target=_blank>Java语言中内存管理的几个技巧</A>
<LI><A href="http://www.programfan.com/article/3271.html"
target=_blank>对Java中Set的深入研究</A>
<LI><A href="http://www.programfan.com/article/3270.html"
target=_blank>用java匿名类来简化调试</A> </LI></UL></DIV>
<DIV class=td2>
<H1>最新招聘信息</H1>
<SCRIPT src="PB程序中在普通激光打印机上实现条码打印—编程爱好者网站 programfan_com.files/jobcode.htm"
type=text/javascript></SCRIPT>
</DIV>
<DIV class=tdad>
<DIV align=center><IFRAME id=ksu_style_1046 marginWidth=0 marginHeight=0
src="PB程序中在普通激光打印机上实现条码打印—编程爱好者网站 programfan_com.files/bdun.htm" frameBorder=0
width=280 scrolling=no height=260></IFRAME></DIV></DIV></DIV>
<DIV class=clear></DIV>
<DIV id=globalfooter>
<TABLE width=755 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#ffffff>
<P align=center>
<SCRIPT type=text/javascript>
cpro_client='yaozheng_cpr';
cpro_cbd='#ED945A';
cpro_cbg='#FFFFFF';
cpro_ctitle='#0000ff';
cpro_cdesc='#444444';
cpro_curl='#008000';
cpro_clink='#FFFFFF';
cpro_flush=1;
cpro_w=728;
cpro_h=90;
cpro_template='text_noframe_728_90';
</SCRIPT>
<SCRIPT language=JavaScript
src="PB程序中在普通激光打印机上实现条码打印—编程爱好者网站 programfan_com.files/cp.js"
type=text/javascript></SCRIPT>
</P></TD></TR></TBODY></TABLE>
<DIV align=center>
<TABLE cellSpacing=1 cellPadding=0 width=755 border=0>
<TBODY>
<TR>
<TD width="100%" bgColor=#ffffff>
<HR noShade SIZE=1>
<P align=center><A href="http://www.programfan.com/aboutus.asp">关于本站</A> -
<A href="http://www.programfan.com/daohang.asp">网站导航</A> - <A
href="http://www.programfan.com/ad.asp">广告服务</A> - <A
href="http://www.programfan.com/joinus.asp">诚邀加盟</A> - <A
href="http://www.programfan.com/contact.asp?subject=关于网站">联系站长</A>
- <A href="http://www.programfan.com/friendlink.asp">友情链接</A>
- <A
href="http://www.programfan.com/sponsor.asp">赞助本站</A><BR>Copyright©
1999-2008 Programfan.com. All Rights Reserved<BR>网站制作&维护:Hannibal
Email: <A
href="mailto:webmaster@pfan.cn">webmaster@pfan.cn</A></P></TD></TR></TBODY></TABLE></DIV>
<SCRIPT type=text/javascript>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</SCRIPT>
<SCRIPT type=text/javascript>
var pageTracker = _gat._getTracker("UA-1952745-1");
pageTracker._trackPageview();
</SCRIPT>
</DIV>
<SCRIPT
src="PB程序中在普通激光打印机上实现条码打印—编程爱好者网站 programfan_com.files/6235007045041189.js"></SCRIPT>
<!--<script language="javascript" type="text/javascript" src="http://spcode.baidu.com/spcode/spstyle/style1101.jsp?tn=yaozheng_sp&ctn=0&styleid=1101"></script>//-->
<SCRIPT>var tixa_bad_mm_flag=true;</SCRIPT>
<SCRIPT>var tixa_bad_mm_pos=1;</SCRIPT>
<SCRIPT>var tixa_bad_mm_style='style_2-1';</SCRIPT>
<SCRIPT>var tixa_bad_mm_info=0;</SCRIPT>
<SCRIPT
src="PB程序中在普通激光打印机上实现条码打印—编程爱好者网站 programfan_com.files/bhvad.htm"></SCRIPT>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -