PrintBooleanProperty Clase

Definición

Representa una Boolean propiedad (y su valor) de un componente de software o hardware del sistema de impresión.

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
Herencia
PrintBooleanProperty

Ejemplos

En el ejemplo siguiente se muestra cómo usar esta clase al instalar una segunda impresora cuyas propiedades difieren de una impresora existente solo en la ubicación, el puerto y el estado compartido.

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()

Constructores

Nombre Description
PrintBooleanProperty(String, Object)

Inicializa una nueva instancia de la PrintBooleanProperty clase para la propiedad especificada que usa el valor especificado.

PrintBooleanProperty(String)

Inicializa una nueva instancia de la PrintBooleanProperty clase para el atributo especificado.

Propiedades

Nombre Description
IsDisposed

Obtiene o establece un valor que indica si el objeto se ha eliminado.

(Heredado de PrintProperty)
IsInitialized

Obtiene o establece un valor que indica si el objeto se ha inicializado.

(Heredado de PrintProperty)
Name

Cuando se reemplaza en una clase derivada, obtiene el nombre de la propiedad que representa el objeto.

(Heredado de PrintProperty)
Value

Obtiene o establece el valor de la propiedad que PrintBooleanProperty representa .

Métodos

Nombre Description
Dispose()

Libera todos los recursos que usa .PrintProperty

(Heredado de PrintProperty)
Dispose(Boolean)

Libera los recursos no administrados que usa PrintProperty y, opcionalmente, libera los recursos administrados.

(Heredado de PrintProperty)
Equals(Object)

Determina si el objeto especificado es igual al objeto actual.

(Heredado de Object)
GetHashCode()

Actúa como función hash predeterminada.

(Heredado de Object)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
InternalDispose(Boolean)

Libera los recursos no administrados que usa PrintProperty y, opcionalmente, libera los recursos administrados.

(Heredado de PrintProperty)
MemberwiseClone()

Crea una copia superficial del Objectactual.

(Heredado de Object)
OnDeserialization(Object)

Cuando se reemplaza en una clase derivada, implementa la ISerializable interfaz y genera el evento de deserialización cuando se completa la deserialización.

(Heredado de PrintProperty)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Operadores

Nombre Description
Implicit(PrintBooleanProperty to Boolean)

Proporciona la conversión implícita a de un Boolean puntero a .PrintBooleanProperty

Se aplica a