Solved

HELP!! **Printing Graphics**

Posted on 1998-11-10
5
167 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now