VB.Net by API/System.Drawing.Printing/PrinterSettings

Материал из VB Эксперт
Версия от 12:50, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

PrinterSettings.InstalledPrinters

  
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class GetInstalledPrinters
   public Shared Sub Main
        Dim PrinterName As String
        For Each PrinterName In System.Drawing.Printing.PrinterSettings.InstalledPrinters
            Console.WriteLine(PrinterName)
        Next
   End Sub
End class


PrinterSettings.IsDefaultPrinter

  
Imports System
Imports System.Drawing.Printing
Module Client
    Sub Main()
        Dim pd As PrintDocument = New PrintDocument()
        Dim pg As PageSettings = pd.DefaultPageSettings
        Dim ps As PrinterSettings = pg.PrinterSettings
    
        Console.WriteLine("PrinterName = " + pd.PrinterSettings.PrinterName)
        Console.WriteLine("Is default Printer = " + _
                             ps.IsDefaultPrinter.ToString())
        Console.WriteLine("Is plotter = " + ps.IsPlotter.ToString())
    End Sub
End Module


PrinterSettings.IsPlotter

  
Imports System
Imports System.Drawing.Printing
Module Client
    Sub Main()
        Dim pd As PrintDocument = New PrintDocument()
        Dim pg As PageSettings = pd.DefaultPageSettings
        Dim ps As PrinterSettings = pg.PrinterSettings
    
        Console.WriteLine("PrinterName = " + pd.PrinterSettings.PrinterName)
        Console.WriteLine("Is default Printer = " + _
                             ps.IsDefaultPrinter.ToString())
        Console.WriteLine("Is plotter = " + ps.IsPlotter.ToString())
    End Sub
End Module


PrinterSettings.MaximumCopies

  
Imports System
Imports System.Drawing.Printing
Module Client
    Sub Main()
        Dim pd As PrintDocument = New PrintDocument()
        Dim pg As PageSettings = pd.DefaultPageSettings
        Dim ps As PrinterSettings = pg.PrinterSettings
    
        Console.WriteLine("Is printer valid = " + ps.IsValid.ToString())
        Console.WriteLine("Can Duplex = " + ps.IsValid.ToString())
        Console.WriteLine("Num copies = " + ps.Copies.ToString())
        Console.WriteLine("Max Copies = " + ps.MaximumCopies.ToString())
        Console.WriteLine("Max Page = " + ps.MaximumPage.ToString())
        Console.WriteLine("Min Page = " + ps.MinimumPage.ToString())
        Console.WriteLine("Supports Color = " + ps.SupportsColor.ToString())
    End Sub
End Module


PrinterSettings.SupportsColor

  
Imports System
Imports System.Drawing.Printing
Module Client
    Sub Main()
        Dim pd As PrintDocument = New PrintDocument()
        Dim pg As PageSettings = pd.DefaultPageSettings
        Dim ps As PrinterSettings = pg.PrinterSettings
    
        Console.WriteLine("Is printer valid = " + ps.IsValid.ToString())
        Console.WriteLine("Can Duplex = " + ps.IsValid.ToString())
        Console.WriteLine("Num copies = " + ps.Copies.ToString())
        Console.WriteLine("Max Copies = " + ps.MaximumCopies.ToString())
        Console.WriteLine("Max Page = " + ps.MaximumPage.ToString())
        Console.WriteLine("Min Page = " + ps.MinimumPage.ToString())
        Console.WriteLine("Supports Color = " + ps.SupportsColor.ToString())
    End Sub
End Module