PrintStringProperty Clase

Definición

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

public ref class PrintStringProperty sealed : System::Printing::IndexedProperties::PrintProperty
[System.Serializable]
public sealed class PrintStringProperty : System.Printing.IndexedProperties.PrintProperty
public sealed class PrintStringProperty : System.Printing.IndexedProperties.PrintProperty
[<System.Serializable>]
type PrintStringProperty = class
    inherit PrintProperty
type PrintStringProperty = class
    inherit PrintProperty
Public NotInheritable Class PrintStringProperty
Inherits PrintProperty
Herencia
PrintStringProperty
Atributos

Ejemplos

En el ejemplo siguiente se muestra cómo usar esta clase para instalar una segunda impresora que difiere en sus propiedades 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

PrintStringProperty(String)

Inicializa una nueva instancia de la clase PrintStringProperty para la propiedad especificada.

PrintStringProperty(String, Object)

Inicializa una instancia nueva de la clase PrintStringProperty que tiene el valor especificado para la propiedad especificada.

Propiedades

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 invalida en una clase derivada, obtiene el nombre de la propiedad representada por el objeto.

(Heredado de PrintProperty)
Value

Obtiene o establece el valor de la propiedad representada por PrintStringProperty.

Métodos

Dispose()

Libera todos los recursos utilizados por PrintProperty.

(Heredado de PrintProperty)
Dispose(Boolean)

Libera los recursos no administrados utilizados por PrintProperty y, de forma opcional, libera los recursos administrados.

(Heredado de PrintProperty)
Equals(Object)

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetHashCode()

Sirve como la 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 utilizados por PrintProperty y, de forma opcional, libera los recursos administrados.

(Heredado de PrintProperty)
MemberwiseClone()

Crea una copia superficial del Object actual.

(Heredado de Object)
OnDeserialization(Object)

Cuando se invalida en una clase derivada, implementa la interfaz ISerializable y provoca el evento de deserialización cuando la deserialización ha finalizado.

(Heredado de PrintProperty)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Operadores

Implicit(PrintStringProperty to String)

Proporciona la conversión implícita en un valor de String de un puntero a PrintStringProperty.

Se aplica a