Solved

HELP!! **Printing Graphics**

Posted on 1998-11-10
5
169 Views
Last Modified: 2013-11-13
I need QUICK help!!!
I need to be able to print graphics (.bmp) files to the printer, and have no idea how...
For example, my output needs to look something like this:

[text]
[graphic1.bmp] [graphic2.bmp] [graphic3.bmp] ...

[text]
[graphic2.bmp] [graphic3.bmp] [graphic1.bmp] ...

ETC...

Thanks!
0
Comment
Question by:econy1
  • 3
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 1444162
You need to load the graphic into an image box or picture box and then

Printer.PaintPicture image1.Image, X, Y


0
 

Author Comment

by:econy1
ID: 1444163
okay, i thought of doing this.
now, what values go in for X and Y, so that the images print on the paper in the format i want them to (see format in original question.).
0
 

Author Comment

by:econy1
ID: 1444164
also...
in VB5, is it still image1.image, or image1.picture   ?
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1444165
You have to fiddle with the X/Y values to position the image where you want. There are 1440 Twips in one inch. So if you want the image positioned 2" in from the left and 3" down from the top you'd specify 2880, 4320. Remember there is a "dead zone" around the printer that is *added* to these numbers. 0,0 is the upper left corner and defines the limit of the dead zone.

Printer.PaintPicture Picturebox1.Image, 0, 0

Here is syntax from help:

Syntax

object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode

The PaintPicture method syntax has these parts:

Part      Description
object      Optional. An object expression that evaluates to an object in the Applies To list. If object is omitted, the Form object with the focus is assumed to be object.

Picture      Required. The source of the graphic to be drawn onto object. Must be the Picture property of a Form or PictureBox.

x1, y1      Required. Single-precision values indicating the destination coordinates (x-axis and y-axis) on object for picture to be drawn. The ScaleMode property of object determines the unit of measure used.

Width1      Optional. Single-precision value indicating the destination width of picture. The ScaleMode property of object determines the unit of measure used. If the destination width is larger or smaller than the source width (width2), picture is stretched or compressed to fit. If omitted, the source width is used.

Height1      Optional. Single-precision value indicating the destination height of picture. The ScaleMode property of object determines the unit of measure used. If the destination height is larger or smaller than the source height (height2), picture is stretched or compressed to fit. If omitted, the source height is used.

x2, y2      Optional. Single-precision values indicating the coordinates (x-axis and y-axis) of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, 0 is assumed.

Width2      Optional. Single-precision value indicating the source width of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, the entire source width is used.

Height2      Optional. Single-precision value indicating the source height of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, the entire source height is used.

Opcode      Optional. Long value or code that is used only with bitmaps. It defines a bit-wise operation (such as vbMergeCopy or vbSrcAnd) that is performed on picture as it's drawn on object. For a complete list of bit-wise operator constants, see the RasterOp Constants topic in Visual Basic Help.

Remarks
You can flip a bitmap 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, don't 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.

0
 

Author Comment

by:econy1
ID: 1444166
i guess this is the only way.  it's unfortunate, because there should be an easier way.  i will eventually accept your answer, but i want to leave it open just a little while longer to see if there may be an easier, more efficient way to doing this.  
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question