PrintStringProperty Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Represents a String property (and its value) of a printing system hardware or software component.

Namespace:   System.Printing.IndexedProperties
Assembly:  System.Printing (in System.Printing.dll)

System.Object
  System.Printing.IndexedProperties.PrintProperty
    System.Printing.IndexedProperties.PrintStringProperty

[SerializableAttribute]
public sealed class PrintStringProperty : PrintProperty

NameDescription
System_CAPS_pubmethodPrintStringProperty(String)

Initializes a new instance of the PrintStringProperty class for the specified property.

System_CAPS_pubmethodPrintStringProperty(String, Object)

Initializes a new instance of the PrintStringProperty class that has the specified value for the specified property.

NameDescription
System_CAPS_protpropertyIsInitialized

Gets or sets a value that indicates whether the object has been initialized.(Inherited from PrintProperty.)

System_CAPS_pubpropertyName

When overridden in a derived class, gets the name of the property that the object represents.(Inherited from PrintProperty.)

System_CAPS_pubpropertyValue

Gets or sets the value of the property that the PrintStringProperty represents.(Overrides PrintProperty.Value.)

NameDescription
System_CAPS_pubmethodDispose()

Releases all resources that are being used by the PrintProperty. (Inherited from PrintProperty.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodOnDeserialization(Object)

When overridden in a derived class, implements the ISerializable interface and raises the deserialization event when the deserialization is complete.(Inherited from PrintProperty.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticImplicit(PrintStringProperty to String)

Provides implicit conversion to a String value from a pointer to a PrintStringProperty.

System_CAPS_puboperatorSystem_CAPS_staticImplicit(PrintStringProperty to String)

Provides implicit conversion from a PrintStringProperty to a String value.

The following example shows how to use this class to install a second printer that differs in its properties from an existing printer only in location, port, and shared status.

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

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: