Printer.Width Property

Gets or sets the width of a page.

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

Syntax

'Declaration
Public Property Width As Integer
    Get
    Set
public int Width { get; set; }
public:
property int Width {
    int get ();
    void set (int value);
}
member Width : int with get, set
function get Width () : int
function set Width (value : int)

Property Value

Type: System.Int32
Returns an Integer.

Remarks

For the Printer object, the Height and Width properties are always measured in twips; they return the physical dimensions of the paper that the printing device is currently set to use. If set at run time, values in these properties are used instead of the setting of the PaperSize property.

If you set the Height and Width properties for a printer driver that does not allow these properties to be set, no error occurs. The size of the paper remains unchanged.

If you set a Height or Width value for a printer driver that does not allow that value, no error occurs. The property is set to a value that the driver allows. For example, you could set Height to 150 and the driver would set it to 144.

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 retrieve the Height and Width property values.

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()

.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