老师 可以是打印的时候保存的窗口自己设定默认吗?
此主题相关图片如下:截图_20203322123331.jpg

e.Form.Page.Width =297 '纸张宽度为100毫米
e.Form.Page.Height =210'纸张高度为120毫米
e.Form.Page.LeftMargin = 10 '设置左边距
e.Form.Page.RightMargin = 0 '设置右边距
e.Form.Page.TopMargin = 20 '设置上边距
e.Form.Page.BottomMargin = 20 '设置下边距
Dim grp As WinForm.GroupBox = e.Form.Controls("GroupBox1")
Dim doc As PrintDoc = e.Form.GernatePrintDoc(grp)
Dim rar As new prt.RenderArea
rar.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Dim rm As prt.RenderImage
rm = New prt.RenderImage '创建一个图片
rm.Width = 15 '宽度等于页面宽度
rm.Height = 15 '高度由图片大小自动决定
rm.Image = GetImage("匹士克logo.png")
rm.x = 121
rm.y = 0
Dim ra As New prt.RenderText '设置文本对象的内容
ra.Text = e.Form.Controls("Label13").text
ra.Style.TextAlignHorz = prt.AlignHorzEnum.right
ra.Style.TextAlignVert =prt.AlignVertEnum.Bottom
ra.Style.Borders.Bottom = New prt.LineDef(1, Color.Black) '设置底边框
ra.Style.Padding.Bottom = 2 '底端内容缩进0.5毫米
ra.Style.FontSize = 12 '字体大小为8磅
ra.Height = 10
Dim rt As New prt.RenderText '设置文本对象的内容
rt.Text = "第[PageNo]页,共[PageCount]页" '设置文本内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '靠右对齐
rt.Style.Borders.Top = New prt.LineDef(1, Color.Black) '设置底边框
rt.Style.Padding.Top = 0.5 '底端内容缩进0.5毫米
rt.Style.FontSize = 12 '字体大小为8磅
rt.Height = 15
rar.Children.Add(rm) '加入图片到RenderArea中
rar.Children.Add(ra) '加入文本到RenderArea中
Doc.Pageheader = rar '作为页眉使用
Doc.PageFooter = rt '作为页眉使用
doc.PageSetting.Landscape = True '横向打印
'设置页眉
doc.Preview() '预览
[此贴子已经被作者于2020/11/22 12:33:55编辑过]