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
属性

次の例では、このクラスを使用して、場所、ポート、および共有状態でのみ、既存のプリンターとはプロパティが異なる 2 つ目のプリンターをインストールする方法を示します。

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 インターフェイスを実装し、逆シリアル化が完了したときに逆シリアル化イベントを発生させます。

(継承元 PrintProperty)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

演算子

Implicit(PrintStringProperty to String)

String へのポインターから PrintStringProperty 値への暗黙の型変換を提供します。

適用対象