02-14-2011 11:04 AM
Trying to print a simple graph, but the fule is unreadable. The function returns success when SetPrintAttribute() is set to either option. I've attached the bitmap which should be roughly as below (yes I know it needs work!)
02-15-2011 12:56 AM
Hi , can you explain better do you have any error code ?
I know there was a problem with the CVI Run-Time engine with some graph issue
but if you can explain better maybe I'll be able to assist you..
02-15-2011 03:54 AM
Thanks but that didn't make any difference. Opening the file in a hex viewer shows that the start is a load of random print driver settings. I'd say it's looking like a bug at the moment.
02-15-2011 10:24 AM
I don't completely understand your situation. Which file is this, exactly? Is this a .bmp file that you are trying to display on the graph? And which SetPrintAttribute options are you referring to?
Luis
02-16-2011 03:12 AM
The file I attached is a bitmap file produced by PrintCtrl but renamed as this board won't accept .bmp extensions. The SetPrintAttribute options I referred either draws the control to an intermediate bitmap or not. The whole thing is a cheap'n'dirty way to print a graph onto a report, since NIReports doesn't offer this feature and I haven't got the time to spare to do it properly in Word and Excel.
02-16-2011 04:35 AM
As far as I can understand you want to obtain an image out of your graph and include it in a report with NIReport_AppendImageFile.
If this is your situation you could:
1. Obtain a bitmap of your graph control with GetCtrlDisplayBitmap
2. Save the bitmap to a file with SaveBitmapToBMPFile or SavebitmapToJPEGFile
3. Discard the bitmap
4. Append the image tot he report
The file you obtain from PrintCtrl is a print file (i.e. a file intended to be sent to the printer, that includes control codes for the printer). The intermediate bitmap optionally used internallyby PrintCtrl is not available for direct use.
02-16-2011 07:35 AM
Thanks, that clears things up nicely. I have been using GetScaledCtrlDisplayBitmap, but am having to save at 2/3 scale and the image is blurry. I think we're becoming victims of ever increasing screen resolution, since the size of paper never changes.
02-16-2011 07:57 AM
You could duplicate the graph on a hidden panel and rescale it before getting the image of the control: with auto divisions on at least axes and grid should maintain a good aspect even on small sizes.