VB.NET中怎么获取当前打印机的纸张类型
展开全部
我是VB.NET 2010版本
窗体上添加一个按钮,代码如下:
Imports System.Drawing.Printing
Public Class Form1
'采用关键字WithEvents声明一个PrintDocument对象,会引发它的PrintPage事件
Private WithEvents My_PrintDocument As PrintDocument
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'实例化PrintDocument对象
My_PrintDocument = New PrintDocument
'显示默认的打印机名称
MsgBox(My_PrintDocument.PrinterSettings.PrinterName)
'显示默认的打印机纸张类型名称
MsgBox(My_PrintDocument.DefaultPageSettings.PaperSize.ToString)
End Sub
End Class
窗体上添加一个按钮,代码如下:
Imports System.Drawing.Printing
Public Class Form1
'采用关键字WithEvents声明一个PrintDocument对象,会引发它的PrintPage事件
Private WithEvents My_PrintDocument As PrintDocument
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'实例化PrintDocument对象
My_PrintDocument = New PrintDocument
'显示默认的打印机名称
MsgBox(My_PrintDocument.PrinterSettings.PrinterName)
'显示默认的打印机纸张类型名称
MsgBox(My_PrintDocument.DefaultPageSettings.PaperSize.ToString)
End Sub
End Class
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询