e.Form.BaseForm.windowstate = 2
e.Form.ResumeRedraw
e.Form.StopRedraw
Dim lb3 As WinForm.Label = e.Form.Controls("Label3")
If e.Form.Width > lb3.Width
lb3.Left = (e.Form.Width - lb3.Width ) / 2
End If
e.form.controls("combobox1").combolist = String.Join("|", InstalledPrinters.Toarray)
e.form.controls("combobox1").Text = DefaultPrinter
e.Form.ResumeRedraw
e.Form.StopRedraw
Dim doc As New PrintDoc
Doc.PageSetting.BottomMargin = 0
Doc.PageSetting.topMargin = 3
Doc.PageSetting.leftMargin = 0
Doc.PageSetting.rightMargin = 0
doc.PageSetting.Width = 60 '纸张宽度为100毫米
doc.PageSetting.Height = 30 '纸张高度为120毫米
doc.AutoRotate = False
Dim tbl As Table = Tables("成绩")
tbl.sort= "考号"
Dim rm As prt.RenderEmpty '定一个空对象
For i As Integer = 0 To tbl.Rows.count-1
rm.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rm)
Dim r As Row = tbl.Rows(i)
Dim rx As new prt.RenderText
rx.Style.Font = New Font("黑体", 18, FontStyle.Bold) '设置字体
rx.style.TextAlignHorz=prt.AlignHorzEnum.Center
rx.text = chr(10) & r("考试名称") & "考试"
doc.Body.Children.Add(rx)
Dim rx2 As new prt.RenderText
rx2.Style.Font = New Font("黑体", 10, FontStyle.Bold) '设置字体
rx2.style.TextAlignHorz=prt.AlignHorzEnum.Center
rx2.text = r("学校班级")
rx2.Style.Spacing.Bottom = 3
doc.Body.Children.Add(rx2)
Dim rx1 As new prt.RenderText
rx1.Style.Font = New Font("黑体", 16, FontStyle.Bold) '设置字体
rx1.style.TextAlignHorz=prt.AlignHorzEnum.Center
rx1.text = r("姓名") & " " & r("考号")
doc.Body.Children.Add(rx1)
Next
'doc.preview()
_MyDoc = Doc
_MyRDL.Document = _MyDoc
Dim p As WinForm.Panel = e.Form.controls("Panel1")
If p.basecontrol.controls.count = 0 Then
_MyRDL.Dock = 5
p.BaseControl.Controls.Add(_MyRDL)
_MyRDL.Toolbars.File.Visible = False
End If
_MyDoc.Generate() '这句替代 doc.Preview() '预览
e.Form.ResumeRedraw
出现未将事例引入到对象,之前没有这个错,是改到什么了呢