PrintPropertyDictionary 클래스

정의

System.Printing 네임스페이스의 개체와 연관된 속성 및 값의 컬렉션을 나타냅니다.

public ref class PrintPropertyDictionary : System::Collections::Hashtable, IDisposable
public ref class PrintPropertyDictionary : System::Collections::Hashtable, IDisposable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
[System.Serializable]
public class PrintPropertyDictionary : System.Collections.Hashtable, IDisposable
public class PrintPropertyDictionary : System.Collections.Hashtable, IDisposable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public class PrintPropertyDictionary : System.Collections.Hashtable, IDisposable
[<System.Serializable>]
type PrintPropertyDictionary = class
    inherit Hashtable
    interface ISerializable
    interface IDeserializationCallback
    interface IDisposable
type PrintPropertyDictionary = class
    inherit Hashtable
    interface IDisposable
    interface IDeserializationCallback
    interface ISerializable
Public Class PrintPropertyDictionary
Inherits Hashtable
Implements IDisposable
Public Class PrintPropertyDictionary
Inherits Hashtable
Implements IDeserializationCallback, IDisposable, ISerializable
상속
PrintPropertyDictionary
특성
구현

예제

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

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

다음 예제에서는 리플렉션을 사용하지 않고 런타임에 이 클래스를 사용하여 인쇄 시스템 개체의 속성 및 해당 속성의 형식을 검색하는 방법을 보여 있습니다.


// Enumerate the properties, and their types, of a queue without using Reflection
LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue defaultPrintQueue = LocalPrintServer.GetDefaultPrintQueue();

PrintPropertyDictionary printQueueProperties = defaultPrintQueue.PropertiesCollection;

Console.WriteLine("These are the properties, and their types, of {0}, a {1}", defaultPrintQueue.Name, defaultPrintQueue.GetType().ToString() +"\n");

foreach (DictionaryEntry entry in printQueueProperties)
{
    PrintProperty property = (PrintProperty)entry.Value;

    if (property.Value != null)
    {
        Console.WriteLine(property.Name + "\t(Type: {0})", property.Value.GetType().ToString());
    }
}
Console.WriteLine("\n\nPress Return to continue...");
Console.ReadLine();

' Enumerate the properties, and their types, of a queue without using Reflection
Dim localPrintServer As New LocalPrintServer()
Dim defaultPrintQueue As PrintQueue = LocalPrintServer.GetDefaultPrintQueue()

Dim printQueueProperties As PrintPropertyDictionary = defaultPrintQueue.PropertiesCollection

Console.WriteLine("These are the properties, and their types, of {0}, a {1}", defaultPrintQueue.Name, defaultPrintQueue.GetType().ToString() + vbLf)

For Each entry As DictionaryEntry In printQueueProperties
    Dim [property] As PrintProperty = CType(entry.Value, PrintProperty)

    If [property].Value IsNot Nothing Then
        Console.WriteLine([property].Name & vbTab & "(Type: {0})", [property].Value.GetType().ToString())
    End If
Next entry
Console.WriteLine(vbLf & vbLf & "Press Return to continue...")
Console.ReadLine()

설명

컬렉션은 사전의 Hashtable 형태를 취합니다. Value 컬렉션의 각 DictionaryEntry 속성은 파생PrintProperty된 클래스의 인스턴스입니다.

생성자

PrintPropertyDictionary()

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

PrintPropertyDictionary(SerializationInfo, StreamingContext)

PrintPropertyDictionary 클래스의 새 인스턴스를 초기화하고 여기에 지정된 SerializationInfoStreamingContext를 제공합니다.

속성

comparer
사용되지 않습니다.
사용되지 않습니다.

IComparer에 사용할 Hashtable를 가져오거나 설정합니다.

(다음에서 상속됨 Hashtable)
Count

Hashtable에 포함된 키/값 쌍의 수를 가져옵니다.

(다음에서 상속됨 Hashtable)
EqualityComparer

IEqualityComparer에 사용할 Hashtable를 가져옵니다.

(다음에서 상속됨 Hashtable)
hcp
사용되지 않습니다.
사용되지 않습니다.

해시 코드를 분배할 수 있는 개체를 가져오거나 설정합니다.

(다음에서 상속됨 Hashtable)
IsFixedSize

Hashtable의 크기가 고정되어 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Hashtable)
IsReadOnly

Hashtable가 읽기 전용인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Hashtable)
IsSynchronized

Hashtable에 대한 액세스가 동기화되어 스레드로부터 안전하게 보호되는지를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Hashtable)
Item[Object]

지정된 키에 연결된 값을 가져오거나 설정합니다.

(다음에서 상속됨 Hashtable)
Keys

ICollection의 키를 포함하는 Hashtable을 가져옵니다.

(다음에서 상속됨 Hashtable)
SyncRoot

Hashtable에 대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다.

(다음에서 상속됨 Hashtable)
Values

ICollection의 값이 들어 있는 Hashtable을 가져옵니다.

(다음에서 상속됨 Hashtable)

메서드

Add(Object, Object)

지정한 키와 값을 가지는 요소를 Hashtable에 추가합니다.

(다음에서 상속됨 Hashtable)
Add(PrintProperty)

PrintProperty에서 파생되는 클래스의 개체 중 지정된 개체를 사전에 추가합니다.

Clear()

Hashtable에서 요소를 모두 제거합니다.

(다음에서 상속됨 Hashtable)
Clone()

Hashtable의 부분 복사본을 만듭니다.

(다음에서 상속됨 Hashtable)
Contains(Object)

Hashtable에 특정 키가 들어 있는지 여부를 확인합니다.

(다음에서 상속됨 Hashtable)
ContainsKey(Object)

Hashtable에 특정 키가 들어 있는지 여부를 확인합니다.

(다음에서 상속됨 Hashtable)
ContainsValue(Object)

Hashtable에 특정 값이 들어 있는지 여부를 확인합니다.

(다음에서 상속됨 Hashtable)
CopyTo(Array, Int32)

Hashtable 요소를 지정한 인덱스의 1차원 Array 인스턴스에 복사합니다.

(다음에서 상속됨 Hashtable)
Dispose()

PrintPropertyDictionary에서 사용하는 모든 리소스를 해제합니다.

Dispose(Boolean)

PrintPropertyDictionary에서 사용하는 관리되지 않는 리소스를 해제하고 관리되는 리소스를 선택적으로 해제합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetEnumerator()

IDictionaryEnumerator를 반복하는 Hashtable를 반환합니다.

(다음에서 상속됨 Hashtable)
GetHash(Object)

지정한 키의 해시 코드를 반환합니다.

(다음에서 상속됨 Hashtable)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetObjectData(SerializationInfo, StreamingContext)

SerializationInfo를 serialize하는 데 필요한 데이터로 PrintPropertyDictionary를 채웁니다.

GetProperty(String)

PrintProperty에서 파생되는 클래스의 개체 중 지정된 속성을 나타내는 개체를 가져옵니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
KeyEquals(Object, Object)

특정 ObjectHashtable의 특정 키와 비교합니다.

(다음에서 상속됨 Hashtable)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
OnDeserialization(Object)

ISerializable 인터페이스를 구현하고, deserialization이 완료되면 deserialization 이벤트를 발생시킵니다.

Remove(Object)

Hashtable에서 키가 지정된 요소를 제거합니다.

(다음에서 상속됨 Hashtable)
SetProperty(String, PrintProperty)

지정된 특성의 값을 PrintProperty에서 파생되는 클래스의 개체로 설정합니다.

ToString()

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

(다음에서 상속됨 Object)

명시적 인터페이스 구현

IEnumerable.GetEnumerator()

컬렉션을 반복하는 열거자를 반환합니다.

(다음에서 상속됨 Hashtable)

확장 메서드

Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.

적용 대상