如果我正確理解你,你想在你自己的程序中控制過程而不使用報告工具?在這種情況下,我將列出關於一個實現的一些想法 -
您可以使用包含區域和區域類型的(可序列化)字典進行簡單的模板功能。當你與一個絕對的區域(標籤本身)工作,比如,你可以這樣做:
Private Template as Dictionary = New dictionary(Of String, TemplateEntry)
Friend Class TemplateEntry
Public MeasureType As MeasureType
Public RegionType As Regiontype
Public X As Single
Public Y As Single
Public Width As Single
Public Height As Single
Public Content as Object
End Class
Friend Enum MeasureType
Centimeters
Millimeters
Inches
Pixels
'...
End Enum
Friend Enum RegionType
Text
[Image]
BarCode
'...
End Enum
然後在你的代碼,你轉換的X,Y,W,H爲基礎的DPI像素,並返回一個Rectangle
例如。您可以XML序列化字典以創建其他模板等等。
Content
字段在分析時被初始化。
要添加例如,你可以這樣做:
Dim tmpl As TemplateEntry = New TemplateEntry
tmpl.MeasureType = MeasureType.Millimeters
'...
Template.Add("Barcode", tmpl)
然後「渲染」的模板到你的畫布打印:
For Each tLine in Template
Dim r as rectangle = CalcMeasuresIntoPixels(tmpl)
'...
' render each element based on type and location
Next
希望這給了一些輸入。
來源
2012-10-16 14:36:28
K3N
我認爲值得注意的是,當我說Label時,我的意思是一個物理標籤可以粘貼到某個東西上,而不是表單上的標籤框。 – Brandon