Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

printing dashed or dotted plot lines of a cwgraph

Hi,

there is a problem with printing the ControlImage of a CWGraph, if the CWGraph has plots with dashed or dotted plot lines. On the screen the CWGraph shows these plot line types correctly. But if I print a ControlImage of the CWGraph, all plots have solid line styles. It is independend from any printer driver. The VS SP6 and the NI Measurement Studio Updater are installed - nothing changed. I've tried the ControlImageEx method too - the same result - only solid lines, not dashed or dotted.

Do you have a suggestion?
Thanks
Ralf
0 Kudos
Message 1 of 3
(6,198 Views)
To printout the dashed lines, you will need to first set the LineWidth of the plot to 0. This is required becuse the Windows drawing API does not render certain types of lines correctly if the width is greater than 0.

Then to get the output correctly to the printer, you will need to use the DPI value of the printer and pass that to ControlImageEx. Generally printers have a higher DPI value than the monitor(96 by default), so the image needs to be set up appropriately.

So try this

Picture1.Picture = CWGraph1.ControlImageEx(Printer.PrintQuality, Printer.PrintQuality)
Printer.PaintPicture Picture1, 100, 100

I hope this helps
Bilal Durrani
NI
Message 2 of 3
(6,188 Views)
Thanks for the helpful tips. To set the line width to 0 is the important tip.

The Printer.PrintQuality can also have negative values (-1 for Draft ...-4 for HighQuality). This depends from the printer driver used. But the CWGraph.ControlImageEx method seems not to handle this correctly. It works fine with positive dpi values (300,600...). So I check first if the Printer.PrintQuality has a positive value. Otherwise I set a PrinterQuality of 150 for Draft or Low Quality and 300 for Medium or High Quality. So it works.

Ralf
0 Kudos
Message 3 of 3
(6,181 Views)