GC.Collect()
'e.Form.Page.Width = 210 '纸张宽度为100毫米
'e.Form.Page.Height = 297 '纸张高度为120毫米
Dim p As WinForm.Panel = e.Form.Controls("pnl_body")
For Each a As WinForm.Control In e.Form.Controls
If a.Name.Contains("TextBox") Then
Dim c As WinForm.TextBox = a
If c.BorderStyle = BorderStyle.FixedSingle Then
c.PrintBorder = True
End If
End If
a.Printable = True
a.NewPage = False
Next
e.Form.Page.PaperKind = 9
'e.Form.Page.Width = 210 '纸张宽度为100毫米
'e.Form.Page.Height = 297 '纸张高度为120毫米
e.Form.Page.LeftMargin = 3 '设置左边距
e.Form.Page.RightMargin = 5 '设置右边距
e.Form.Page.TopMargin = 2 '设置上边距
e.Form.Page.BottomMargin = 1 '设置下边距
Dim doc As PrintDoc = e.Form.GernatePrintDoc(p)
'doc.PageSetting.Width = 210 '纸张宽度为100毫米
'doc.PageSetting.Height = 297 '纸张高度为120毫米
'doc.PageSetting.LeftMargin = -20
'doc.PageSetting.TopMargin = 1
doc.AutoRotate = False
Dim aa As String = ProjectPath & "导出文件\设计版单\" & Date.Today & Rand.NextString(5) & ".jpg"
doc.SaveImage(aa)
此主题相关图片如下:snipaste_2024-02-26_15-34-04.png
Dim Proc As New Process '打开工作簿
Proc.File = aa.Replace(".jpg", "_page1.jpg")
Proc.Start()