次の方法で共有


Printer.Width プロパティ

更新 : 2007 年 11 月

ページの幅を取得または設定します。

名前空間 :  Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
アセンブリ :  Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)

構文

'宣言
Public Property Width As Integer
'使用
Dim instance As Printer
Dim value As Integer

value = instance.Width

instance.Width = value
public int Width { get; set; }
public:
property int Width {
    int get ();
    void set (int value);
}
public function get Width () : int
public function set Width (value : int)

プロパティ値

型 : System.Int32

Integer を返します。

解説

Printer オブジェクトの場合、Height および Width プロパティは常に twip 単位です。これらは、印刷デバイスで現在設定されている用紙の物理的なサイズを返します。実行時に設定された場合、これらのプロパティの値は PaperSize プロパティの設定値の代わりに使用されます。

Height プロパティおよび Width プロパティの設定を許容しないプリンタ ドライバに対してこれらのプロパティを設定しても、エラーは発生しません。用紙のサイズは変更されません。

Height 値または Width 値をプリンタ ドライバが許容しない値に設定しても、エラーは発生しません。プロパティは、ドライバの許容する値に設定されます。たとえば、Height を 150 に設定すると、ドライバがそれを 144 に設定することがあります。

メモ :

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 名前空間の関数とオブジェクトは、Visual Basic 6.0 から Visual Basic 2008 へのアップグレード ツールで使用するために用意されています。ほとんどの場合、これらの関数とオブジェクトは、.NET Framework の他の名前空間にある機能と重複しています。これらが必要になるのは、Visual Basic 6.0 のコード モデルが .NET Framework の実装と大きく異なる場合だけです。

Height および Width プロパティの値を取得する方法を次の例に示します。

Dim Printer As New Printer
Dim nHeight As Integer = Printer.Height
Dim nWidth As Integer = Printer.Width
Printer.Print("Paper size is " & CStr(nHeight) & " by " _
    & CStr(nWidth) & " twips")
Printer.EndDoc()

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

Printer クラス

Printer メンバ

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

その他の技術情報

Printer Compatibility Library

方法 : Printer Compatibility Library を使用してアップグレード エラーを修正する (Visual Basic)

Printer Compatibility Library を参照するアプリケーションの配置