Re: multiple images in one page




Mike Williams ha escrito:

<regforos@xxxxxxxxx> wrote in message
news:1150859171.614848.327520@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

My problem was how to arrange the pictures in the page, ill try
to do that by code then, if someone knows any more graphical
way to do this, please tell me.

What do you mean by a "more graphical [and therefore presumably easier]
way"? Do you mean easier for you as a programmer, or easier for your user?
Do you want to write code which will allow the user to select and load
pictures, and then manually resize them and drag them around the page
wherever he wants? Or do you want him to select and load a number of
different pictures and then click some buttons to tell your program how many
pictures he wants on a page and then have your program take care arranging
the page and printing it for him? Or do you perhaps mean something else? It
is possible to write code to do just about anything you want, but you need
to be very specific about exactly what it is you want to do.

i want graphically, to make it more "friendly" to the final user,
so he can choose the paper size, printer, etc, but if that doesn't
exists i code it)

There are all sorts of different ways of allowing the user to chose a
printer, ranging from the "not a lot of code but not very good" to the "tons
of code but almost perfect", with lots of other methods in between those two
extremes. So, it all depends on how much work you are prepared to put into
it.

At its simplest you can drop a CommonDialog Control on your Form and use its
ShowPrinter method and then draw your page using the VB Printer Object and
its various methods (Print, Line, PaintPicture and various others). That is
the simplest way, but it is also the least effective because to work
properly the VB Printer Object relies on the system allowing the printer
dialog to change the user's default printer and all its settings. This does
not work on WinXP because it will only allow the dialog to change the actual
printer. It will not allow it to change any of its settings (orientation,
print quality, etc). Also, it is never a good idea for your code to do
anything that changes the user's default printer, because most users have
that set up the way they want it for all normal purposes, and your own code
should not change that. It isn't a nice thing to do.

Another method is to write your own printer dialog, using a modal Form with
various buttons and Combo Boxes, and to use Set Printer to change the VB
printer object so that it prints to the printer selected by the user. You
can also change the VB printer objects settings (or at least some of them)
in accordance with the settings he chose in your own dialog. This fixes the
main problem mentioned above, because it leaves the default printer settings
alone. However, it presents your user with a dialog that he will not be
familiar with and it has other limitations as well.

A third method would be to present your user with an API printer dialog,
which is capable of exposing many more properties than the standard
CommonDialog one, and then transfer the user's settings to the VB Printer
Object. This is about the best method you can get if you want to use the VB
Printer Object for your printing, and is the method recommended by Microsoft
on the MSDN site. It does not mess up the user's default printer or its
settings and it exposes quite a lot of printer settings. It is not perfect
though, and there are quite a few things it cannot do, partly because there
are still some things that it does not expose and partly because some of the
things it does expose cannot be reliably passed to the VB printer object. I
had the link to that site here somewhere, but I seem to have lost it. I'm
sure someone else will post it for you though.

A fourth method would be to use a CommonDialog Control printer dialog but
set its PrinterDefault property to False and its ReturnDC flag to 1 and then
print your stuff to the Device Context it returns. This method gives your
user full access to all of his printers and allows him to change all of
their settings and it does this without altering his default settings at
all. However, it means that you cannot use the VB Printer Object and you
instead have to use the various API methods for all your printing. This is
juts about the best method to use, but it does require you to write a lot of
code.

Also, since you seem to be interested in printing pictures more than
anything else, whichever method you use you need to ensure that you are
printing them properly. There isn't really a problem in this respect on
systems running at standard 32 bit full colour depth, but for systems
running at less than this (16 bit perhaps) you need to ensure that you are
using a method which prints them without degrading the picture's own colour
depth. This is fairly easy to do, but it does need to be taken into
consideration.

The reason I'm telling you all this is because you haven't gone into a great
deal of detail about your specific requirements or about what you expect
from the code samples people may post, and specifically you haven't said
anything at all about how much code you have already written and how hard
you have already tried to do the job for yourself. Lots of people here will
be very pleased to help you out, but very few will have either the time or
the inclination to write a complete VB application or a large part of it for
you. So, perhaps you might like to post again with more details.

Mike

wow! thanks a lot (seriusly), i dont know why i dont said this before,
for some reason i assume that:
I am printing barcodes, so B&W, but has to maintain quality to be read
later, the user selects of what objects he want to print the barcode,
the barcode is saved in BMP, and i have to print that.
I just found my error, this code works:

Printer.Print
Printer.ScaleMode = vbCentimeters
Printer.PaintPicture LoadPicture(App.Path & "\1.bmp"), 5, 5
Printer.PaintPicture LoadPicture(App.Path & "\2.bmp"), 5, 10
Printer.PaintPicture LoadPicture(App.Path & "\3.bmp"), 5, 15
Printer.EndDoc

I've been thinking and the only important parameter I need to set for
print is if the paper is "office" or "A4". Im thinking about use the
same code i paste, and if office, print more lines. im printing on an
inkjet printer now, so i dont know if the quality is suitable to be
readed by a barcode reader.
Thanks a lot Mike, now im looking for suggestions for better quality
(but i think that the quality im having now is great), and to draw
lines vertical and horizontally across the page (i know partially how
to do this, im going to read some more).
Thanks a lot again, if you have any suggestiong im hearing :)
sorry about my english and if something is hard to understand

.


Loading