PrintBooleanProperty Класс

Определение

Представляет свойство Boolean (а также его значение) программного или аппаратного компонента системы печати.

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
Наследование
PrintBooleanProperty

Примеры

В следующем примере показано, как использовать этот класс при установке второго принтера, свойства которого отличаются от существующего принтера только по расположению, порту и общему состоянию.

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

Конструкторы

PrintBooleanProperty(String)

Инициализирует новый экземпляр класса PrintBooleanProperty для указанного атрибута.

PrintBooleanProperty(String, Object)

Инициализирует новый экземпляр класса PrintBooleanProperty для указанного свойства, в котором используется указанное значение.

Свойства

IsDisposed

Возвращает или задает значение, указывающее, был ли удален объект.

(Унаследовано от PrintProperty)
IsInitialized

Возвращает или задает значение, указывающее, инициализирован ли объект.

(Унаследовано от PrintProperty)
Name

При переопределении в производном классе возвращает имя свойства, которое представлено объектом.

(Унаследовано от PrintProperty)
Value

Получает или задает значение свойства, которое представляет PrintBooleanProperty.

Методы

Dispose()

Освобождает все ресурсы, используемые PrintProperty.

(Унаследовано от PrintProperty)
Dispose(Boolean)

Освобождает неуправляемые (а при необходимости и управляемые) ресурсы, используемые объектом PrintProperty.

(Унаследовано от PrintProperty)
Equals(Object)

Определяет, равен ли указанный объект текущему объекту.

(Унаследовано от Object)
GetHashCode()

Служит хэш-функцией по умолчанию.

(Унаследовано от Object)
GetType()

Возвращает объект Type для текущего экземпляра.

(Унаследовано от Object)
InternalDispose(Boolean)

Освобождает неуправляемые (а при необходимости и управляемые) ресурсы, используемые объектом PrintProperty.

(Унаследовано от PrintProperty)
MemberwiseClone()

Создает неполную копию текущего объекта Object.

(Унаследовано от Object)
OnDeserialization(Object)

При переопределении в производном классе реализует интерфейс ISerializable и вызывает событие десериализации при завершении десериализации.

(Унаследовано от PrintProperty)
ToString()

Возвращает строку, представляющую текущий объект.

(Унаследовано от Object)

Операторы

Implicit(PrintBooleanProperty to Boolean)

Предоставляет неявное преобразование из значения Boolean, взятого из указателя, в значение PrintBooleanProperty.

Применяется к