PrintStringProperty 생성자

정의

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

오버로드

PrintStringProperty(String)

지정한 속성에 대해 PrintStringProperty 클래스의 새 인스턴스를 초기화합니다.

PrintStringProperty(String, Object)

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

PrintStringProperty(String)

지정한 속성에 대해 PrintStringProperty 클래스의 새 인스턴스를 초기화합니다.

public:
 PrintStringProperty(System::String ^ attributeName);
public PrintStringProperty (string attributeName);
new System.Printing.IndexedProperties.PrintStringProperty : string -> System.Printing.IndexedProperties.PrintStringProperty
Public Sub New (attributeName As String)

매개 변수

attributeName
String

String가 나타내는 PrintStringProperty 속성의 이름입니다.

설명

합니다 attributeName 철자를 다 써야 몇 가지 특정 이름의와 똑같이 String 대/소문자를 포함 하 여 인쇄 시스템 개체의 속성입니다. 예를 들어 개체의 PrintSystemJobInfo 속성은 Submitter "제출자"가 아닌 "제출자"로 철자가 지정되어야 합니다.

적용 대상

PrintStringProperty(String, Object)

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

public:
 PrintStringProperty(System::String ^ attributeName, System::Object ^ attributeValue);
public PrintStringProperty (string attributeName, object attributeValue);
new System.Printing.IndexedProperties.PrintStringProperty : string * obj -> System.Printing.IndexedProperties.PrintStringProperty
Public Sub New (attributeName As String, attributeValue As Object)

매개 변수

attributeName
String

String가 나타내는 PrintStringProperty 속성의 이름입니다.

attributeValue
Object

PrintStringProperty가 나타내는 속성의 값입니다.

예제

다음 예제에서는 이 생성자를 사용하여 위치, 포트 및 공유 상태 기존 프린터와 속성이 다른 두 번째 프린터를 설치하는 방법을 보여 줍니다.

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 철자를 다 써야 몇 가지 특정 이름의와 똑같이 String 대/소문자를 포함 하 여 인쇄 시스템 개체의 속성입니다. 예를 들어 개체의 PrintSystemJobInfo 속성은 Submitter "제출자"가 아닌 "제출자"로 철자가 지정되어야 합니다.

적용 대상