Dela via


Printer.ScaleWidth Property

Gets or sets the number of units for the horizontal measurement of the page when you use graphics methods.

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

Syntax

'Declaration
Public Property ScaleWidth As Single
    Get
    Set
public float ScaleWidth { get; set; }
public:
property float ScaleWidth {
    float get ();
    void set (float value);
}
member ScaleWidth : float32 with get, set
function get ScaleWidth () : float
function set ScaleWidth (value : float)

Property Value

Type: System.Single
Returns a Single.

Remarks

You can use the ScaleHeight and ScaleWidth properties to create a custom coordinate scale for drawing or printing. For example, the statement ScaleHeight = 100 changes the units of measurement of the height of the page. Instead of the height being some number of current units (twips or pixels, for example), the height will be 100 user-defined units. Therefore, a distance of 50 units is half the height of the page, and a distance of 101 units will exceed the boundaries of the page by 1 unit.

Use the ScaleMode property to define a scale based on a standard unit of measurement, such as twips, points, pixels, characters, inches, millimeters, or centimeters.

Setting the ScaleHeight and ScaleWidth properties to positive values makes coordinates increase from top to bottom and left to right. Setting them to negative values makes coordinates increase from bottom to top and right to left.

By using these properties and the related ScaleLeft and ScaleTop properties, you can create a coordinate system with both positive and negative coordinates. All four of these scale properties interact with the ScaleMode property in the following ways:

  • Setting another scale property to any value automatically sets ScaleMode to 0. A ScaleMode of 0 is user-defined.

  • Setting ScaleMode to a number larger than 0 changes ScaleHeight and ScaleWidth to the new unit of measurement and sets ScaleLeft and ScaleTop to 0. In addition, the CurrentX and CurrentY settings change to reflect the new coordinates of the current point.

You can also use the Scale method to set the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties in one statement.

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 set the ScaleHeight and ScaleWidth properties.

Dim Printer As New Printer
Dim Radius As Integer
Printer.ScaleHeight = 100
Printer.ScaleWidth = 100
Printer.FillStyle = 1
For Radius = 5 To 50 Step 5
    Printer.Circle(50, 50, Radius)
Next Radius
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