我晕,单独用例子试可以,怎么放在我的窗体 里就不行了呢。
If e.Form.Controls("ComFFFS").Value = "现金" Then
Dim s1 As String = "-----------------"
e.Form.Controls("TextFFYH").Text = s1
e.Form.Controls("TextFFYHZH").Text = s1
e.Form.Controls("ComSFYH").Text = s1
e.Form.Controls("TextSFYHZH").Text = s1
End If
'e.Form.Page.Landscape = True '横向打印
e.Form.Page.Width = 210 '纸张宽度为100毫米
e.Form.Page.Height = 120 '纸张高度为120毫米
e.Form.Page.LeftMargin = 10 '设置左边距
e.Form.Page.RightMargin = 10 '设置右边距
e.Form.Page.TopMargin = 10 '设置上边距
e.Form.Page.BottomMargin = 10 '设置下边距
Dim doc As PrintDoc = e.Form.GernatePrintDoc()
doc.Preview()