RMC_Draw2File function.
Draws a chart into a *.jpg, *.png or *.emf file

Syntax
nResult (LONG) = RMC_Draw2File(
ByVal nCtrlId (LONG),
ByRef sFileName (ASCIIZ),
Optional ByVal nWidth (LONG),
Optional ByVal nHeight (LONG),
Optional ByVal nJPGQualityLevel (LONG)
)
Parameter
nCtrlId (LONG)
Unique ID of the chart control, which shall be saved.
sFileName (ASCIIZ)
Path and name of the file, which shall be created. The extension of sFileName can be: png, jpg, emf or emf+. If you want to save the chart as a bitmap, you should use png, because the file size is smaller than with jpg. No rule without exception: I made the experience, that with pies and donuts as well as with thumbnails jpg is smaller then png.
emf is compatible with the GDI's EMF-files (but up to 25 times bigger than emf+), while emf+ works only with GDI+. When saved to disk, both types have the extension *.emf.
nWidth (LONG)
Width of the bitmap, which shall be drawn into the file, in pixel. See Remarks
nHeight (LONG)
Height of the bitmap, which shall be drawn into the file, in pixel. See Remarks
nJPGQualityLevel (LONG)
Compression ratio (and therefore the quality) of the bitmap, if you save it as JPG/JPEG. Valid values are between 1 (highest compression, lowest quality) to 100 (lowest compression, highest quality). If omitted or 0: the standard compression ratio of GDI+ is used, which is something around 75 (I guess).
Return value
0
No error, function succeeded.
RMC_ERROR_CTRLID
Wrong control ID (0 or no chart with this control ID was found).
RMC_ERROR_EMF
Error while creating the EMF file.
Remarks
You can call RMC_Draw2File either any time after you called RMC_Draw (for instance if your user clicked on an available Save button) or "stand alone", without painting on the screen. In this case parameter nExportOnly in RMC_CreateChart() must be TRUE. Then, after the necessary function calls for designing your chart, you call RMC_Draw2File, followed by RMC_DeleteChart()!

You should use the optional parameters nWidth and nHeight only if you want to save your chart as a thumbnail Use in this case a *.jpg extension because of the smaller size compared to *.png. It's not recommended to use these parameters for other scaling purposes.