Solved

HELP!! **Printing Graphics**

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

14 Experts available now in Live!

Get 1:1 Help Now