PrintBooleanProperty クラス

定義

印刷システムのハードウェアまたはソフトウェア コンポーネントの Boolean プロパティ (およびその値) を表します。

public ref class PrintBooleanProperty sealed : System::Printing::IndexedProperties::PrintProperty
public sealed class PrintBooleanProperty : System.Printing.IndexedProperties.PrintProperty
type PrintBooleanProperty = class
    inherit PrintProperty
Public NotInheritable Class PrintBooleanProperty
Inherits PrintProperty
継承
PrintBooleanProperty

次の例では、場所、ポート、および共有状態でのみ、プロパティが既存のプリンターと異なる 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()

コンストラクター

PrintBooleanProperty(String)

指定した属性の PrintBooleanProperty クラスの新しいインスタンスを初期化します。

PrintBooleanProperty(String, Object)

指定した値を使用する指定したプロパティの PrintBooleanProperty クラスの新しいインスタンスを初期化します。

プロパティ

IsDisposed

オブジェクトが破棄されたかどうかを示す値を取得または設定します。

(継承元 PrintProperty)
IsInitialized

オブジェクトが初期化されているかどうかを示す値を取得または設定します。

(継承元 PrintProperty)
Name

派生クラスでオーバーライドされると、オブジェクトが表すプロパティの名前を取得します。

(継承元 PrintProperty)
Value

PrintBooleanProperty が表すプロパティの値を取得または設定します。

メソッド

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(PrintBooleanProperty to Boolean)

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

適用対象