
此主题相关图片如下:snipaste_2023-08-01_15-00-57.bmp
以下是窗口的打印代码,预览时没有黑底白字,控件的Printable属性已设置为true
e.Form.Page.Width = 50 '纸张宽度为100毫米
e.Form.Page.Height = 120 '纸张高度为120毫米
e.Form.Page.LeftMargin = 0 '设置左边距
e.Form.Page.RightMargin = 0 '设置右边距
e.Form.Page.TopMargin = 0 '设置上边距
e.Form.Page.BottomMargin = 0 '设置下边距
Dim doc As PrintDoc = e.Form.GernatePrintDoc()
doc.PageSetting.Width = 50 '纸张宽度为100毫米
doc.PageSetting.Height = 120 '纸张高度为120毫米
doc.AutoRotate = False

此主题相关图片如下:snipaste_2023-08-01_15-00-48.bmp

Dim ps As new System.Drawing.Printing.PrinterSettings
ps.Copies = e.form.controls("NumericComboBox1").value '设置份数'
doc.Preview()