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)


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

Property Value

Type: System.Int32

Returns an Integer.


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.


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.


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

See Also

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


Return to top