Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I print the displayed graph? I am using Measurement Studio for Visual Basic.

a
0 Kudos
Message 1 of 3
(3,308 Views)
By far the easiest way to do this would be to call the PrintForm method on the form. This, however, would print the entire form (minus the title bar with the minimize, maximize, and close buttons). Does printing the form solve your problem of do you need to print only the graph?

- Elton
Message 2 of 3
(3,308 Views)
It is true that calling the PrintForm method is the easiest way to print your graph. However, if you wish to print only the graph, and not the rest of your form, there is a way to do this also.

The CWGraph control, and some other CW controls, supports the ControlImage method which returns a Windows metafile containing an image of the graph. You can then send this image to your printer using environment-specific printer commands.

In Visual Basic, use the Printer.PaintPicture command to send the metafile, and top and left coordinates to the printer. Then call Printer.EndDoc to flush the job to the printer:

Printer.PaintPicture CWGraph1.ControlImage, 0, 0
Printer.EndDoc

In the above code, the second and third parameters specify the position of the image o
n the page; you can also enlarge or shrink the image by specifying width and height. You may want to take a look at the Visual Basic PaintPicture function help for more details on this function.
J.R. Allen
Message 3 of 3
(3,308 Views)