以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]二维码说明文本居中  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=52694)

--  作者:云淡风轻
--  发布时间:2014/6/20 15:52:00
--  [求助]二维码说明文本居中
我在设置说明文本时RenderText的宽度和RenderArea的宽度是一样的, rt.Width = "Parent.Width" ,另外,我给他设置成居中rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center ,但效果还不是居中, 
图片点击可在新窗口打开查看此主题相关图片如下:qq截图20140620154232.jpg
图片点击可在新窗口打开查看
何因?
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:二维码功能.foxdb


--  作者:Bin
--  发布时间:2014/6/20 15:55:00
--  
那就把这个RT往左移动一点
--  作者:云淡风轻
--  发布时间:2014/6/20 16:03:00
--  
但我已经设置成居中了,没道理呀
--  作者:Bin
--  发布时间:2014/6/20 16:04:00
--  
不好使就移动一下
--  作者:有点甜
--  发布时间:2014/6/20 16:06:00
--  

 代码,你的ra还有一部分空白的区域的。

 

If CurrentTable.ShowCheckBox = False Then
    messagebox.show("请先点击\'打印前置\'按钮,在想要打印二维码的行的复选框里打√,谢谢!","友情提示")
Else
    Dim doc As New PrintDoc
    Dim Bar As New BarCodeBuilder
    Dim rt As new prt.RenderText
    Bar.Symbology = Barpro.Symbology.QRCode
    Bar.BarRatio = 0.3
    Bar.BarWidth = 1
    Bar.BarHeight = 1
    Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
   
    If CurrentTable.name = "案卷库" Then
        For Each r As Row In CurrentTable.GetCheckedRows
            bar.Code = "(1)案卷题名:" & r("案卷题名") & ";(2)编制单位:" & r("编制单位") & ";(3)编制日期:" & r("编制日期")
            If r("文件件数") IsNot Nothing And r("文件件数") <> "0" Then
                For i As Integer = 1 To Cint(r("文件件数"))
                    Dim ra As New prt.RenderArea
                    ra.Style.Padding.Right = 9
                    ra.Style.BackColor = Color.red
                    ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割
                    ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割
                    ra.width = 39
                    ra.height = 48
                   
                    Dim rg1 As New prt.RenderGraphics()
                    rg1.Graphics.DrawImage(bar.GetImage,0,0,120,120)
                    rg1.Graphics.DrawImage(getImage("archives.ico"),45,45,30,30)
                    ra.Children.Add(rg1)
                    rt = New prt.RenderText
                    If r("文件件数") > 0 And r("文件件数") < 10 Then
                        rt.Text = r("档号") & "-0" & i
                    Else
                        If i > 0 And i < 10 Then
                            rt.Text = r("档号") & "-0" & i
                        Else
                            rt.Text = r("档号") & "-" & i
                        End If
                    End If
                    rt.Width = "Parent.Width"
                    rt.Height = 10
                    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
                    ra.Children.Add(rt) \'添加到容器中
                    Doc.Body.Children.Add(ra)
                Next
            End If
        Next
        Doc.Preview()
    End If
End If