PrintBooleanProperty 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表 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
- 繼承
範例
以下範例說明如何在安裝第二台印表機時使用此類別,該印表機的屬性僅在位置、埠口及共享狀態上與現有印表機不同。
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()
建構函式
| 名稱 | Description |
|---|---|
| PrintBooleanProperty(String, Object) |
初始化一個使用指定值的類別新實例 PrintBooleanProperty 。 |
| PrintBooleanProperty(String) |
初始化該類別的新實例 PrintBooleanProperty 以對應指定屬性。 |
屬性
| 名稱 | Description |
|---|---|
| IsDisposed |
會取得或設定一個值,表示該物件是否已被處置。 (繼承來源 PrintProperty) |
| IsInitialized |
取得或設定一個值,表示物件是否已被初始化。 (繼承來源 PrintProperty) |
| Name |
當在衍生類別中覆寫時,會取得該物件所代表的屬性名稱。 (繼承來源 PrintProperty) |
| Value |
取得或設定該 PrintBooleanProperty 財產的價值。 |
方法
| 名稱 | Description |
|---|---|
| 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) |
運算子
| 名稱 | Description |
|---|---|
| Implicit(PrintBooleanProperty to Boolean) |
提供從指標隱Boolean式轉換為 PrintBooleanProperty 的 。 |