以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  请教下条码标签的设计  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=24537)

--  作者:rjh4078
--  发布时间: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()


--  作者:狐狸爸爸
--  发布时间:2012/10/16 20:17:00
--  
Dim doc As New PrintDoc
doc.PageSetting.Width = 60
doc.PageSetting.Height = 40
Doc.PageSetting.LeftMargin = 5
Doc.PageSetting.TopMargin = 5

...
...
 

--  作者:rjh4078
--  发布时间: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()

 


--  作者:mickeygy
--  发布时间:2014/1/2 23:05:00
--  

感谢分享 请教下text的字体是怎么设置呢?


--  作者:狐狸爸爸
--  发布时间:2014/1/3 14:44:00
--  
以下是引用mickeygy在2014-1-2 23:05:00的发言:

感谢分享 请教下text的字体是怎么设置呢?

http://www.foxtable.com/help/topics/1179.htm