次の方法で共有


Printer.PaintPicture Method

Prints the contents of an image file on a page.

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

Syntax

'Declaration
Public Sub PaintPicture ( _
    picture As Image, _
    x1 As Single, _
    y1 As Single, _
    width1 As Single, _
    height1 As Single, _
    x2 As Single, _
    y2 As Single, _
    width2 As Single, _
    height2 As Single _
)
public void PaintPicture(
    Image picture,
    float x1,
    float y1,
    float width1,
    float height1,
    float x2,
    float y2,
    float width2,
    float height2
)
public:
void PaintPicture(
    Image^ picture, 
    float x1, 
    float y1, 
    float width1, 
    float height1, 
    float x2, 
    float y2, 
    float width2, 
    float height2
)
member PaintPicture : 
        picture:Image * 
        x1:float32 * 
        y1:float32 * 
        width1:float32 * 
        height1:float32 * 
        x2:float32 * 
        y2:float32 * 
        width2:float32 * 
        height2:float32 -> unit
public function PaintPicture(
    picture : Image, 
    x1 : float, 
    y1 : float, 
    width1 : float, 
    height1 : float, 
    x2 : float, 
    y2 : float, 
    width2 : float, 
    height2 : float
)

Parameters

  • x1
    Type: System.Single

    Single value indicating the horizontal destination coordinates where the image will be printed. The ScaleMode property determines the units of measure used.

  • y1
    Type: System.Single

    Single value indicating the vertical destination coordinates where the image will be printed. The ScaleMode property determines the units of measure used.

  • width1
    Type: System.Single

    Optional. Single value indicating the destination width of the picture. The ScaleMode property of object determines the units of measurement used. If the destination width is larger or smaller than the source width, picture is stretched or compressed to fit. If omitted, the source width is used.

  • height1
    Type: System.Single

    Optional. Single value indicating the destination height of the picture. The ScaleMode property of object determines the units of measurement used. If the destination height is larger or smaller than the source height, picture is stretched or compressed to fit. If omitted, the source height is used.

  • x2
    Type: System.Single

    Optional. Single values indicating the coordinates (x-axis) of a clipping region within picture. The ScaleMode property of object determines the units of measurement used. If omitted, 0 is assumed.

  • y2
    Type: System.Single

    Optional. Single values indicating the coordinates (y-axis) of a clipping region within picture. The ScaleMode property of object determines the units of measurement used. If omitted, 0 is assumed.

  • width2
    Type: System.Single

    Optional. Single value indicating the source width of a clipping region within picture. The ScaleMode property of object determines the units of measurement used. If omitted, the entire source width is used.

  • height2
    Type: System.Single

    Optional. Single value indicating the source height of a clipping region within picture. The ScaleMode property of object determines the units of measurement used. If omitted, the entire source height is used.

Remarks

You can flip a picture horizontally or vertically by using negative values for the destination height (height1) and/or the destination width (width1).

You can omit as many optional trailing arguments as you want. If you omit an optional trailing argument or arguments, do not use any commas following the last argument you specify. If you want to specify an optional argument, you must specify all optional arguments that appear in the syntax before it.

Note

The Visual Basic 6.0 version of the Printer object included an additional parameter, OpCode, which was used to perform bitwise operations on a bitmap image. This parameter is no longer supported.

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. 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 print an image on a page, stretching or shrinking it to a specific size. It assumes that you have added an Image resource to your project named Image1.

Dim pr As New Printer
pr.PaintPicture(My.Resources.Image1, 500, 500, 1000, 1000)
pr.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