I am trying to export charts to files of various formats . Most work fine. However, while wmf export is ok, the emf crashes in the Winapi.GDIPOBJ in the following function
Code: Select all
function TGPGraphics.MeasureString(string_: WideString; length: Integer; font: TGPFont;
const origin: TGPPointF; out boundingBox: TGPRectF): TStatus;
var
nFont: GpFont;
rect: TGPRectF;
begin
if assigned(font) then nfont := font.nativeFont else nfont := nil;
rect.X := origin.X;
rect.Y := origin.Y;
rect.Width := 0.0;
rect.Height := 0.0;
result := SetStatus(GdipMeasureString(
nativeGraphics,
PWideChar(string_),
length,
nfont,
@rect,
nil,
@boundingBox,
nil,
nil
));
end;
The teechart version is Pro 2022.36
My code is simply:
Code: Select all
Case SaveDialog.FilterIndex of
1: qualitychart.SaveToBitmapFile(SaveDialog.FileName); // BMP
2: begin // JPG
With GetChartJPEG(Qualitychart) do
try
SaveToFile(savedialog.filename); { <-- save the JPEG to disk }
finally
Free; { <-- free the temporary JPEG object }
end;
end;
3: Qualitychart.SaveToMetafile(SaveDialog.FileName); // WMF
4: Qualitychart.SaveToMetafileEnh(SaveDialog.FileName) ; //EMF
5: TeeSaveToPNG(QualityChart,SaveDialog.FileName); // png
6: TeeSaveToPDFFile(QualityChart,savedialog.FileName); // pdf
End;
Jon