參考來源
--
Imports System.Drawing.Printing
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim printDoc As New PrintDocument()
Dim sDefaultPrinter As String = printDoc.PrinterSettings.PrinterName '取得預設的印表機名稱
'取得安裝於電腦上的所有印表機名稱,加入 ListBox (Name : lbInstalledPrinters) 中
For Each strPrinter As String In PrinterSettings.InstalledPrinters
Me.lbInstalledPrinters.Items.Add(strPrinter)
Next
'ListBox (Name : lbInstalledPrinters) 選擇在預設印表機
Me.lbInstalledPrinters.SelectedIndex = Me.lbInstalledPrinters.FindString(sDefaultPrinter)
End Sub
End Class
沒有留言:
張貼留言