PrintBooleanProperty 생성자

정의

PrintBooleanProperty 클래스의 새 인스턴스를 초기화합니다.

오버로드

PrintBooleanProperty(String)

지정된 특성에 대한 PrintBooleanProperty 클래스의 새 인스턴스를 초기화합니다.

PrintBooleanProperty(String, Object)

지정된 값을 사용하는 지정된 속성에 대해 PrintBooleanProperty 클래스의 새 인스턴스를 초기화합니다.

PrintBooleanProperty(String)

지정된 특성에 대한 PrintBooleanProperty 클래스의 새 인스턴스를 초기화합니다.

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)

매개 변수

attributeName
String

Boolean가 나타내는 PrintBooleanProperty 특성의 이름입니다.

설명

합니다 attributeName 철자를 다 써야 몇 가지 특정 이름의와 똑같이 Boolean 대/소문자를 포함 하 여 인쇄 시스템 개체의 속성입니다. 예를 들어 합니다 IsBusy 의 속성을 PrintQueue 철자 "IsBusy", "사용 중" 않거나 "Isbusy" 개체를 해야 합니다.

적용 대상

PrintBooleanProperty(String, Object)

지정된 값을 사용하는 지정된 속성에 대해 PrintBooleanProperty 클래스의 새 인스턴스를 초기화합니다.

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)

매개 변수

attributeName
String

Boolean가 나타내는 PrintBooleanProperty 속성의 이름입니다.

attributeValue
Object

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

설명

합니다 attributeName 철자를 다 써야 몇 가지 특정 이름의와 똑같이 Boolean 대/소문자를 포함 하 여 인쇄 시스템 개체의 속성입니다. 예를 들어 합니다 IsBusy 의 속성을 PrintQueue 철자 "IsBusy", "사용 중" 않거나 "Isbusy" 개체를 해야 합니다.

적용 대상