共用方式為


Printer.Orientation 屬性

取得或設定值,指出文件是以直向或橫向列印。

命名空間:  Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
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)

屬性值

類型:Int16
傳回 Short。

備註

如果您將這個屬性,在呼叫 Print 方法後,會產生執行階段例外狀況時發生。

下表列出 Orientation 的屬性是有效的 PrinterObjectConstants 值。

常數

說明

vbPRORPortrait

1

文件垂直列印。 頁面的高度大於寬度。

vbPRORLandscape

2

文件水平列印。 頁面的寬度大於高度。

注意事項注意事項

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 命名空間中的函式和物件都是供這些工具使用,以便從 Visual Basic 6.0 升級至 Visual Basic。在大多數情況下,這些函式和物件會複製在 .NET Framework 的其他命名空間中可以找到的功能。只有當 Visual Basic 6.0 程式碼模型與 .NET Framework 實作有顯著差異時,才需要這些項目。

範例

下列範例示範如何設定 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 安全性

請參閱

參考

Printer 類別

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 命名空間

其他資源

Printer Compatibility Library

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

Deploying Applications That Reference the Printer Compatibility Library