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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29697390/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 19:02:40  来源:igfitidea点击:

How to adjust the paper size in vb.net

vb.netprinting

提问by Smit

i have the following code to print the page, i want to add custom page size how do i do that?

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

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

回答by Rajnikant Sharma

You can set the paper size using DefaultPageSettings.PaperSize properties of document Example:

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

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

Me.DefaultPageSettings.PaperSize = xCustomSize

Fine more information here

在这里了解更多信息