如何在vb.net中调整纸张大小

时间:2015-04-17 11:02:13

标签: vb.net printing

我有以下代码来打印页面,我想添加自定义页面大小我该怎么做?

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

    PrintDialog1.AllowSomePages = True
    PrintDialog1.ShowHelp = True
    PrintDialog1.Document = docToPrint
    Dim result As DialogResult = PrintDialog1.ShowDialog()
    If (result = DialogResult.OK) Then
        docToPrint.Print()
    End If

End Sub

1 个答案:

答案 0 :(得分:1)

您可以使用文档的DefaultPageSettings.PaperSize属性设置纸张大小 例如:

Dim xCustomSize As New PaperSize("Legal", 850, 1400)

Me.DefaultPageSettings.PaperSize = xCustomSize

更多信息here