Foxtable(狐表)用户栏目专家坐堂 → 请教下条码标签的设计


  共有7234人关注过本帖树形打印复制链接

主题:请教下条码标签的设计

帅哥哟,离线,有人找我吗?
rjh4078
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3360 积分:24792 威望:0 精华:0 注册:2012/3/26 21:47:00
请教下条码标签的设计  发帖心情 Post By:2012/10/16 20:08:00 [显示全部帖子]

看了下帮助文件 自定义设计了一个标签 代码如下  现在有几个问题 

1.如何加入条码

2.自定义了纸张 为什么生成以后的页面 内容不是铺满整个页面 而是偏右下呢

 

 

Dim doc As New PrintDoc
doc.PageSetting.Width = 60
doc.PageSetting.Height = 40

doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

    Dim ra As New prt.RenderArea
    Dim rt As prt.RenderText
    ra.Width = 50
    ra.Height = 30
    ra.Style.Spacing.All = 1
    ra.Style.Borders.All = New prt.Linedef(0.3, Color.black)
    ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never
    ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never
    Doc.Body.ChildRen.Add(ra)

    rt = New prt.RenderText
    rt.Text = "名称:" & "海尔冰箱"
    rt.X = 2
    rt.Y = 2
    ra.Children.Add(rt)

    rt = New prt.RenderText
    rt.Text = "单位" & "台"
    rt.X = 2
    rt.Y = "Prev.Bottom + 2"
    ra.Children.Add(rt)

    rt = New prt.RenderText
    rt.Text = "条码:" & "5690058765423"
    rt.X = 2
    rt.Y = "Prev.Bottom + 2"
    ra.Children.Add(rt)

    Doc.Preview()


 回到顶部
帅哥哟,离线,有人找我吗?
rjh4078
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3360 积分:24792 威望:0 精华:0 注册:2012/3/26 21:47:00
  发帖心情 Post By:2012/10/16 22:04:00 [显示全部帖子]

感谢狐爸晚上快速回复

经过测试  已经成功设置了标签功能 分享下代码

 

 


Dim doc As New PrintDoc
doc.PageSetting.Width = 60 '标签宽
doc.PageSetting.Height = 40 '标签高
Doc.PageSetting.LeftMargin = 2 ’标签框架左边距
Doc.PageSetting.TopMargin = 2 '标签框架上边距

doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

Dim ra As New prt.RenderArea
Dim rt As prt.RenderText
ra.Width = 56 ’标签框架宽
ra.Height =36 '标签框架高
ra.Style.Spacing.All = 1
ra.Style.Borders.All = New prt.Linedef(0.3, Color.black)
ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never
Doc.Body.ChildRen.Add(ra)

rt = New prt.RenderText
rt.Text = "名称: " & Tables("药材资料").current("名称")
rt.X = 2
rt.Y = 2
ra.Children.Add(rt)

rt = New prt.RenderText
rt.Text = "单位: " & Tables("药材资料").current("商品单位")
rt.X = 2
rt.Y = "Prev.Bottom + 2"
ra.Children.Add(rt)

rt = New prt.RenderText
rt.Text = "SN: "
rt.X = 2
rt.Y = "Prev.Bottom + 2"
ra.Children.Add(rt)
Dim rpar As New prt.RenderParagraph()
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128 ’条码规则
Bar.BarRatio = 0.3
Bar.BarHeight = 8
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
bar.Code = Tables("药材资料").current("条码")
img = new prt.RenderImage
  img.Image = bar.GetImage
Dim rm As New prt.RenderImage '定义一个条码图片对象
rm.Image =bar.getimage '设置条码图片
rm.Width = "Parent.Width" '宽度等于页面宽度
rm.Height = "Auto" '高度由条码图片大小自动决定
rm.Style.ImageAlign.StretchHorz = False '禁止条码图片水平拉伸
rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '水平居中
rm.X=2
rm.y="Prev.Bottom + 2"
ra.Children.Add(rm)
Doc.Preview()

 


 回到顶部