PrintStringProperty 클래스

정의

인쇄 시스템 하드웨어 또는 소프트웨어 구성 요소의 String 속성 및 해당 값을 나타냅니다.

public ref class PrintStringProperty sealed : System::Printing::IndexedProperties::PrintProperty
[System.Serializable]
public sealed class PrintStringProperty : System.Printing.IndexedProperties.PrintProperty
public sealed class PrintStringProperty : System.Printing.IndexedProperties.PrintProperty
[<System.Serializable>]
type PrintStringProperty = class
    inherit PrintProperty
type PrintStringProperty = class
    inherit PrintProperty
Public NotInheritable Class PrintStringProperty
Inherits PrintProperty
상속
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()

생성자

PrintStringProperty(String)

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

PrintStringProperty(String, Object)

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

속성

IsDisposed

개체가 삭제되었는지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 PrintProperty)
IsInitialized

개체가 초기화되었는지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 PrintProperty)
Name

파생 클래스에서 재정의되는 경우 개체가 나타내는 속성의 이름을 가져옵니다.

(다음에서 상속됨 PrintProperty)
Value

PrintStringProperty가 나타내는 속성 값을 가져오거나 설정합니다.

메서드

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 인터페이스를 구현하고 deserialization이 완료되면 deserialization 이벤트를 발생시킵니다.

(다음에서 상속됨 PrintProperty)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

연산자

Implicit(PrintStringProperty to String)

String에 대한 포인터에서 PrintStringProperty 값으로 암시적으로 변환합니다.

적용 대상