Printer.PaintPicture Method (Image, Single, Single, Single, Single, Single, Single, Single, Single)

 

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)

public void PaintPicture(
	Image picture,
	float x1,
	float y1,
	float width1 = NaNf,
	float height1 = NaNf,
	float x2 = 0f,
	float y2 = 0f,
	float width2 = NaNf,
	float height2 = NaNf
)

Parameters

picture
Type: System.Drawing.Image

Image value representing the image to be printed.

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.

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.

System_CAPS_noteNote

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.

System_CAPS_noteNote

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 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()
Return to top
Show: