PrintStringProperty 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
PrintStringProperty 클래스의 새 인스턴스를 초기화합니다.
오버로드
| Name | Description |
|---|---|
| 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
나타내는 속성 PrintStringProperty 의 String 이름입니다.
설명
대 attributeName /소문자를 포함하여 인쇄 시스템 개체의 특정 String 속성 이름과 정확히 같은 철자가 지정되어야 합니다. 예를 들어 개체의 SubmitterPrintSystemJobInfo 속성은 "제출자"가 아니라 "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
나타내는 속성 PrintStringProperty 의 String 이름입니다.
- 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 속성 이름과 정확히 같은 철자가 지정되어야 합니다. 예를 들어 개체의 SubmitterPrintSystemJobInfo 속성은 "제출자"가 아니라 "Submitter"라는 철자가 지정되어야 합니다.