Printer.ColorMode Property
Gets or sets a value specifying whether the output will print in color or in monochrome on a device that supports color.
Namespace: Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'Declaration
Public Property ColorMode As Short
Get
Set
public short ColorMode { get; set; }
public:
property short ColorMode {
short get ();
void set (short value);
}
member ColorMode : int16 with get, set
function get ColorMode () : short
function set ColorMode (value : short)
Property Value
Type: System.Int16
Returns a Short.
Remarks
When the PrintAction property is set to PrintToPrinter and the current printer does not support color, this property is ignored. When the PrintAction property is set to PrintToFile, files are saved in an 8-bit Grayscale PostScript format regardless of the ColorMode value.
If you set this property after you call the Print method, a run-time exception occurs.
The following table lists the PrinterObjectConstants values that are valid for the ColorMode property.
Constant |
Value |
Description |
---|---|---|
vbPRCMMonochrome |
1 |
Print output in monochrome (usually shades of black and white). |
vbPRCMColor |
2 |
Print output in color. |
Note
Functions and objects in the Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic 2010. In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework. They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework implementation.
Examples
The following example checks to see whether the current printer supports color and sets the ColorMode property accordingly.
Dim pr As New Printer
Dim ps As New Printing.PrinterSettings
If ps.SupportsColor = True Then
pr.ColorMode = vbPRCMColor
Else
pr.ColorMode = vbPRCMMonochrome
End If
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace
Other Resources
How to: Fix Upgrade Errors by Using the Printer Compatibility Library (Visual Basic)
Deploying Applications That Reference the Printer Compatibility Library