PrintBooleanProperty Constructors
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Initialiseert een nieuw exemplaar van de PrintBooleanProperty klasse.
Overloads
| Name | Description |
|---|---|
| PrintBooleanProperty(String) |
Initialiseert een nieuw exemplaar van de PrintBooleanProperty klasse voor het opgegeven kenmerk. |
| PrintBooleanProperty(String, Object) |
Initialiseert een nieuw exemplaar van de PrintBooleanProperty klasse voor de opgegeven eigenschap die gebruikmaakt van de opgegeven waarde. |
PrintBooleanProperty(String)
Initialiseert een nieuw exemplaar van de PrintBooleanProperty klasse voor het opgegeven kenmerk.
public:
PrintBooleanProperty(System::String ^ attributeName);
public PrintBooleanProperty(string attributeName);
new System.Printing.IndexedProperties.PrintBooleanProperty : string -> System.Printing.IndexedProperties.PrintBooleanProperty
Public Sub New (attributeName As String)
Parameters
- attributeName
- String
De naam van het Boolean kenmerk dat door het PrintBooleanProperty kenmerk wordt aangeduid.
Opmerkingen
De attributeName naam moet exact hetzelfde worden gespeld als de naam van een bepaalde Boolean eigenschap van een afdruksysteemobject, inclusief behuizing. De eigenschap van een PrintQueue object moet bijvoorbeeld IsBusy worden gespeld als 'IsBusy', niet 'Bezet' of 'Isbusy'.
Van toepassing op
PrintBooleanProperty(String, Object)
Initialiseert een nieuw exemplaar van de PrintBooleanProperty klasse voor de opgegeven eigenschap die gebruikmaakt van de opgegeven waarde.
public:
PrintBooleanProperty(System::String ^ attributeName, System::Object ^ attributeValue);
public PrintBooleanProperty(string attributeName, object attributeValue);
new System.Printing.IndexedProperties.PrintBooleanProperty : string * obj -> System.Printing.IndexedProperties.PrintBooleanProperty
Public Sub New (attributeName As String, attributeValue As Object)
Parameters
- attributeName
- String
De naam van de Boolean eigenschap die door de PrintBooleanProperty eigenschap wordt aangeduid.
- attributeValue
- Object
De waarde van de eigenschap die door de PrintBooleanProperty eigenschap wordt aangeduid.
Voorbeelden
In het volgende voorbeeld ziet u hoe u deze constructor gebruikt tijdens het installeren van een tweede printer die verschilt in de eigenschappen van een bestaande printer, alleen op locatie, poort en gedeelde status.
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()
Opmerkingen
De attributeName naam moet exact hetzelfde worden gespeld als de naam van een bepaalde Boolean eigenschap van een afdruksysteemobject, inclusief behuizing. De eigenschap van een PrintQueue object moet bijvoorbeeld IsBusy worden gespeld als 'IsBusy', niet 'Bezet' of 'Isbusy'.