Printer.Orientation Property

Gets or sets a value indicating whether documents are printed in portrait or landscape mode.

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

Syntax

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

Property Value

Type: System.Int16
Returns a Short.

Remarks

If you set this property after you call the Print method, a run-time exception will occur.

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

Constant

Value

Description

vbPRORPortrait

1

Documents are printed vertically. The height of the page is greater than its width.

vbPRORLandscape

2

Documents are printed horizontally. The width of the page is greater than its height.

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. 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 Orientation property. In this example, the dimensions of the document are used to determine the appropriate orientation.

Dim Printer As New Printer
If Printer.Height > Printer.Width Then
    Printer.Orientation = vbPRORPortrait
Else
    Printer.Orientation = vbPRORLandscape
End If
Printer.Print("Hello")
Printer.EndDoc()

.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