您的位置:逆风者 VB 正文
原作者:www.upwinder.com 添加时间:2007-09-02 原文发表:2007-08-31 人气:137 来源:未知

本文章共5564字,分4页,当前第3页,快速翻页:
 


   Printer.DrawWidth = 1   注释: 线宽为 1

   Printer.FontName = "宋体" 注释: 打印在条码下方字符的字体和大小

   Printer.FontSize = 10

   Dim strBC As String     注释: 要打印的条码字符串
逆风编程精品

   strBC = Ucase(strBarCode)

   注释: 将以毫米表示的 X 坐标转换为以缇表示

   Dim x As Integer

   x = Printer.ScaleX(intXPos, vbMillimeters, VBTwips)

   注释: 将以毫米表示的 Y 坐标转换为以缇表示

   Dim y As Integer

   y = Printer.ScaleY(intYPos, vbMillimeters, VBTwips)

   注释: 将以毫米表示的高度转换为以缇表示

   Dim intHeight As Integer

   intHeight = Printer.ScaleY(intPrintHeight, vbMillimeters, VBTwips)


   注释: 是否在条形码下方打印人工识别字符

   If bolPrintText = True Then

     注释: 条码打印高度要减去下面的字符显示高度

     intHeight = intHeight - Printer.TextHeight(strBC)

   End If

   Const intWidthCU As Integer = 30 注释: 粗线和宽间隙宽度

   Const intWidthXI As Integer = 10 注释: 细线和窄间隙宽度

   Dim intIndex As Integer      注释: 当前处理的字符串索引

   Dim i As Integer, j As Integer, k As Integer  注释: 循环控制变量



   注释: 添加起始字符

   If Left(strBC, 1) <> "*" Then

     strBC = "*" & strBC

   End If

   注释: 添加结束字符

   If Right(strBC, 1) <> "*" Then

     strBC = strBC & "*"

   End If



   注释: 循环处理每个要显示的条码字符

   For i = 1 To Len(strBC)

     注释: 确定当前字符在 strBarTable 中的索引

     Select Case Mid(strBC, i, 1)

     Case "*"

       intIndex = 39

     Case "$"

       intIndex = 38

     Case "%"

       intIndex = 37

     Case "-"

       intIndex = 36

     Case "0" To "9"

       intIndex = CInt(Mid(strBC, i, 1))

     Case "A" To "Z"

       intIndex = Asc(Mid(strBC, i, 1)) - Asc("A") 10

     Case Else

       MsgBox "要打印的条形码字符串中包含无效字符!当前版本只支持字符 注释:0注释:-注释:9注释:,注释:A注释:-注释:Z注释:,注释:-注释:,注释:%注释:,注释:$注释:和注释:*注释:"

     End Select

     注释: 是否在条形码下方打印人工识别字符

     If bolPrintText = True Then

       Printer.CurrentX = x

       Printer.CurrentY = y intHeight

       Printer.Print Mid(strBC, i, 1)

     End If

     For j = 1 To 5

       注释: 画细线

       If Mid(strBarTable(intIndex), j, 1) = "0" Then

         For k = 0 To intWidthXI - 1

           Printer.Line (x k, y)-Step(0, intHeight)

         Next k

         x = x intWidthXI

       注释: 画宽线

       Else

         For k = 0 To intWidthCU - 1

           Printer.Line (x k, y)-Step(0, intHeight)

         Next k

         x = x intWidthCU

       End If

       注释: 每个字符条码之间为窄间隙

       If j = 5 Then

         x = x intWidthXI * 3

         Exit For

       End If

       注释: 窄间隙

       If Mid(strBarTable(intIndex), j 5, 1) = "0" Then

         x = x intWidthXI * 3
 
本文章更多内容<<上一页 - 1 - 2 - 3 - 4 - 下一页>>
相关文章

利用VB实现浮动按钮
在WindowsNT网络中广播消息
VB 从零开始编外挂(八)
API实现完美的图片出现效果
ODBC API 的VB Sample
在系统菜单上添加自定义菜单项
VB 从零开始编外挂(二)
用VB制作即时动态按钮
趣味撞球--VB应用程序一例
教小朋友认识 红绿灯
如何用VB建立快捷方式
带有历史记录功能的菜单
解除网虫心病 VB做定时断线程序
用Visual Basic与MS-Draw开发通用作图软件
制作带有动画和声音的屏幕保护程序
VB中远程共享显示及声音的实现
Love Letter病毒源代码
VB 从零开始编外挂(一)
用VB编写异步多线程下载程序
VB6中使用错误处理对程序速度的影响

相关评论


本文章所属分类:首页 VB

  热门关键字: