Langue

PrintBooleanProperty Classe

Définition

Représente une Boolean propriété (et sa valeur) d’un composant matériel ou logiciel du système d’impression.

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
Héritage
PrintBooleanProperty

Exemples

L’exemple suivant montre comment utiliser cette classe lors de l’installation d’une deuxième imprimante dont les propriétés diffèrent d’une imprimante existante uniquement à l’emplacement, au port et à l’état partagé.

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

Constructeurs

Nom Description
PrintBooleanProperty(String, Object)

Initialise une nouvelle instance de la PrintBooleanProperty classe pour la propriété spécifiée qui utilise la valeur spécifiée.

PrintBooleanProperty(String)

Initialise une nouvelle instance de la PrintBooleanProperty classe pour l’attribut spécifié.

Propriétés

Nom Description
IsDisposed

Obtient ou définit une valeur qui indique si l’objet a été supprimé.

(Hérité de PrintProperty)
IsInitialized

Obtient ou définit une valeur qui indique si l’objet a été initialisé.

(Hérité de PrintProperty)
Name

En cas de substitution dans une classe dérivée, obtient le nom de la propriété que l’objet représente.

(Hérité de PrintProperty)
Value

Obtient ou définit la valeur de la propriété que représente PrintBooleanProperty .

Méthodes

Nom Description
Dispose()

Libère toutes les ressources utilisées par le PrintProperty.

(Hérité de PrintProperty)
Dispose(Boolean)

Libère les ressources non managées utilisées par les PrintProperty ressources gérées et les libère éventuellement.

(Hérité de PrintProperty)
Equals(Object)

Détermine si l’objet spécifié est égal à l’objet actuel.

(Hérité de Object)
GetHashCode()

Sert de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient la Type de l’instance actuelle.

(Hérité de Object)
InternalDispose(Boolean)

Libère les ressources non managées utilisées par les PrintProperty ressources gérées et les libère éventuellement.

(Hérité de PrintProperty)
MemberwiseClone()

Crée une copie superficielle du Objectactuel.

(Hérité de Object)
OnDeserialization(Object)

En cas de substitution dans une classe dérivée, implémente l’interface ISerializable et déclenche l’événement de désérialisation lorsque la désérialisation est terminée.

(Hérité de PrintProperty)
ToString()

Retourne une chaîne qui représente l’objet actuel.

(Hérité de Object)

Opérateurs

Nom Description
Implicit(PrintBooleanProperty to Boolean)

Fournit une conversion implicite vers un Boolean pointeur vers un PrintBooleanProperty.

S’applique à