PrintBooleanProperty Classe

Definizione

Rappresenta una Boolean proprietà (e il relativo valore) di un componente hardware o software del sistema di stampa.

public ref class PrintBooleanProperty sealed : System::Printing::IndexedProperties::PrintProperty
public sealed class PrintBooleanProperty : System.Printing.IndexedProperties.PrintProperty
type PrintBooleanProperty = class
    inherit PrintProperty
Public NotInheritable Class PrintBooleanProperty
Inherits PrintProperty
Ereditarietà
PrintBooleanProperty

Esempio

Nell'esempio seguente viene illustrato come utilizzare questa classe durante l'installazione di una seconda stampante le cui proprietà differiscono da una stampante esistente solo in posizione, porta e stato condiviso.

LocalPrintServer myLocalPrintServer = new LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer);
PrintQueue sourcePrintQueue = myLocalPrintServer.DefaultPrintQueue;
PrintPropertyDictionary myPrintProperties = sourcePrintQueue.PropertiesCollection;

// Share the new printer using Remove/Add methods
PrintBooleanProperty shared = new PrintBooleanProperty("IsShared", true);
myPrintProperties.Remove("IsShared");
myPrintProperties.Add("IsShared", shared);

// Give the new printer its share name using SetProperty method
PrintStringProperty theShareName = new PrintStringProperty("ShareName", "\"Son of " + sourcePrintQueue.Name +"\"");
myPrintProperties.SetProperty("ShareName", theShareName);

// Specify the physical location of the new printer using Remove/Add methods
PrintStringProperty theLocation = new PrintStringProperty("Location", "the supply room");
myPrintProperties.Remove("Location");
myPrintProperties.Add("Location", theLocation);

// Specify the port for the new printer
String[] port = new String[] { "COM1:" };

// Install the new printer on the local print server
PrintQueue clonedPrinter = myLocalPrintServer.InstallPrintQueue("My clone of " + sourcePrintQueue.Name, "Xerox WCP 35 PS", port, "WinPrint", myPrintProperties);
myLocalPrintServer.Commit();

// Report outcome
Console.WriteLine("{0} in {1} has been installed and shared as {2}", clonedPrinter.Name, clonedPrinter.Location, clonedPrinter.ShareName);
Console.WriteLine("Press Return to continue ...");
Console.ReadLine();
Dim myLocalPrintServer As New LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer)
Dim sourcePrintQueue As PrintQueue = myLocalPrintServer.DefaultPrintQueue
Dim myPrintProperties As PrintPropertyDictionary = sourcePrintQueue.PropertiesCollection

' Share the new printer using Remove/Add methods
Dim [shared] As New PrintBooleanProperty("IsShared", True)
myPrintProperties.Remove("IsShared")
myPrintProperties.Add("IsShared", [shared])

' Give the new printer its share name using SetProperty method
Dim theShareName As New PrintStringProperty("ShareName", """Son of " & sourcePrintQueue.Name & """")
myPrintProperties.SetProperty("ShareName", theShareName)

' Specify the physical location of the new printer using Remove/Add methods
Dim theLocation As New PrintStringProperty("Location", "the supply room")
myPrintProperties.Remove("Location")
myPrintProperties.Add("Location", theLocation)

' Specify the port for the new printer
Dim port() As String = { "COM1:" }


' Install the new printer on the local print server
Dim clonedPrinter As PrintQueue = myLocalPrintServer.InstallPrintQueue("My clone of " & sourcePrintQueue.Name, "Xerox WCP 35 PS", port, "WinPrint", myPrintProperties)
myLocalPrintServer.Commit()

' Report outcome
Console.WriteLine("{0} in {1} has been installed and shared as {2}", clonedPrinter.Name, clonedPrinter.Location, clonedPrinter.ShareName)
Console.WriteLine("Press Return to continue ...")
Console.ReadLine()

Costruttori

Nome Descrizione
PrintBooleanProperty(String, Object)

Inizializza una nuova istanza della classe per la PrintBooleanProperty proprietà specificata che utilizza il valore specificato.

PrintBooleanProperty(String)

Inizializza una nuova istanza della PrintBooleanProperty classe per l'attributo specificato.

Proprietà

Nome Descrizione
IsDisposed

Ottiene o imposta un valore che indica se l'oggetto è stato eliminato.

(Ereditato da PrintProperty)
IsInitialized

Ottiene o imposta un valore che indica se l'oggetto è stato inizializzato.

(Ereditato da PrintProperty)
Name

In caso di override in una classe derivata, ottiene il nome della proprietà rappresentata dall'oggetto .

(Ereditato da PrintProperty)
Value

Ottiene o imposta il valore della proprietà rappresentata dall'oggetto PrintBooleanProperty .

Metodi

Nome Descrizione
Dispose()

Rilascia tutte le risorse usate da PrintProperty.

(Ereditato da PrintProperty)
Dispose(Boolean)

Rilascia le risorse non gestite usate da PrintProperty e, facoltativamente, rilascia le risorse gestite.

(Ereditato da PrintProperty)
Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
InternalDispose(Boolean)

Rilascia le risorse non gestite usate da PrintProperty e, facoltativamente, rilascia le risorse gestite.

(Ereditato da PrintProperty)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
OnDeserialization(Object)

Quando sottoposto a override in una classe derivata, implementa l'interfaccia ISerializable e genera l'evento di deserializzazione al termine della deserializzazione.

(Ereditato da PrintProperty)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Operatori

Nome Descrizione
Implicit(PrintBooleanProperty to Boolean)

Fornisce la conversione implicita in un oggetto Boolean da un puntatore a un oggetto PrintBooleanProperty.

Si applica a