how to print from vb application

i have made an graphics application.  i draw at the run time according to my need using graphics methods and activex controls.  this is done in the picture box of the form. what i want is that i should be able to print what i have drawn. the printing should be such that it is with perfect scaling as it appears on the screen.
IN SHORT WHAT I WANT IS
PRINTING TECHNIQUE AND CODING
FOR PRINTING BY AN APPLICATION MADE IN VISUAL BASIC.
WITH PRINTPREVIEW IF POSSIBLE.
modijsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LewyCommented:
Try something like this:

    Dim PrinterOrientationSave As Integer, L$
    PrinterOrientationSave = Printer.Orientation
    Printer.Orientation = vbPRORLandscape
    Printer.FontName = "Arial"
    Printer.FontSize = 14
    Printer.PaintPicture Form2.Image, _
                        (Printer.Width \ 2) - (Form2.Width \ 2), _
                        (Printer.Height \ 2) - (Form2.Height \ 2)
    Printer.CurrentY = Printer.TextHeight("X") * 2
    Printer.CurrentX = Printer.Width \ 2 - Printer.TextWidth(CurveDataName.Text) \ 2
    Printer.Print CurveDataName.Text
    L$ = Format(Date, "mm/dd/yyyy")
    Printer.CurrentY = Printer.ScaleHeight - Printer.TextHeight(L$)
    Printer.CurrentX = Printer.ScaleWidth - Printer.TextWidth(L$)
    Printer.Print L$
    Printer.EndDoc
0
modijsAuthor Commented:
u have used printer object but u have mentioned form.image for printing, this can be done but i need the drawings made at run time in picture box to be printed.  using paintpicture for printer object requires the file to be of bmp format but i want to print the drawing generated in picture box without saving it as bitmap.

i want the general PRINTING TECHNIQUES AND CODE as used in any package like autocad, word etc.
0
LewyCommented:
I use this code to print a chart that I generated at run time. It does not require it to be saved as a bitmap. you can use the picturebox image instead of the form image. The image is a bitmap but it transfers to the printer well. Try it and see what happens.

This is as close, using VB, to the general PRINTING TECHNIQUES AND CODE used by other programs.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

modijsAuthor Commented:
ur method worked for graphics method like line circle etc in picture box but it did not worked for controls in picture box for eg my own usercontrol, it does not come in the print out, how to do this too
0
LewyCommented:
I haven't tryed it but you might be able to BitBlt the image of the control to the printer image in the appropreate location.
Let me know if it works.
0
modijsAuthor Commented:
i dont know how to use bitblt so help in this matter in detail.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.