e.Form.ResumeRedraw
e.Form.StopRedraw
Dim doc As New PrintDoc
Doc.PageSetting.BottomMargin = 0
Doc.PageSetting.topMargin = 5
Doc.PageSetting.leftMargin = 0
Doc.PageSetting.rightMargin = 0
doc.PageSetting.Width = 60 '纸张宽度为100毫米
doc.PageSetting.Height = 30 '纸张高度为120毫米
doc.AutoRotate = False
Doc.PrinterName =e.form.controls("combobox1").Text
Dim tbl As Table = Tables("小学考试用表_table1")
tbl.sort= "考号"
Dim rm As prt.RenderEmpty '定一个空对象
Dim q As Integer = e.Form.Controls("textbox1").value
Dim z As Integer = e.Form.Controls("textbox2").value
'Dim rm As prt.RenderEmpty '定一个空对象
For i As Integer = 0 To tbl.Rows.count-1
rm = new prt.RenderEmpty '定义一个新的空对象
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 = 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.print
这段代码出现几种错误 1、 已删除等候打印的文件。
2、值不能为空。参数名: ptr
3、另一个程序正在使用此文件,进程无法访问。
4、未将对象引用设置到对象的实例。
请求老师想办法