Dela via


Printer.Duplex Property

Gets or sets a value that determines whether a page is printed on both sides (if the printer supports this feature).

Namespace:  Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
Public Property Duplex As Short
    Get
    Set
public short Duplex { get; set; }
public:
property short Duplex {
    short get ();
    void set (short value);
}
member Duplex : int16 with get, set
function get Duplex () : short
function set Duplex (value : short)

Property Value

Type: System.Int16
Returns a Short.

Remarks

When you use horizontal duplex printing, the tops of both sides of the page are on the same end of the sheet. When you use vertical duplex printing, the bottom of one page is at the same end of the sheet as the top of the next page.

If you set this property after you call the Print, Circle, Line, or PSet methods on a new page, a run-time exception occurs.

The following table lists the PrinterObjectConstants values that are valid for the Duplex property.

Constant

Value

Description

vbPRDPSimplex

1

Single-sided printing with the current orientation setting.

vbPRDPHorizontal

2

Double-sided printing using a horizontal page turn.

vbPRDPVertical

3

Double-sided printing using a vertical page turn.

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 demonstrates how to set the Duplex property.

Dim pr As New Printer
Dim ps As New Printing.PrinterSettings
If ps.CanDuplex = True Then
    pr.Duplex = vbPRDPVertical
Else
    MsgBox("Duplex printing is not supported.")
End If

.NET Framework Security

See Also

Reference

Printer Class

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace

Other Resources

Printer Compatibility Library

How to: Fix Upgrade Errors by Using the Printer Compatibility Library (Visual Basic)

Deploying Applications That Reference the Printer Compatibility Library