D12 does a lot to improve the Scaling issues, and for the GUI, it looks good. But when I go to print, I want to turn off the scaling for TCharts so that the reports have the correct font size (rather than scaled-up font size).
This is the chart image I see when the display is scaled to 100% (which is what I want to see--images don't seem to be working, so I will just provide the links):
But when the display is scaled, I see this:
If the display is scaled, how do I create an image from a TChart for reports so the font is not scaled? Here is the procedure I currently use:
Code: Select all
procedure AssignChartToGraphic(aChart: TChart; const aRect: TRect; aGraphic: TGraphic; aTransparent: boolean = false);
var
lHoldShadow: boolean;
I: Integer;
lBoolArray: array of boolean;
lHoldBevel: TBevelCut;
lHoldColor: TColor;
lHoldGradientVisible: boolean;
lMetafile: TMetafile;
lBmp: TBitmap;
lCanvasClass: TCanvas3DClass;
lHoldHover: Boolean;
begin
lCanvasClass := TCanvas3DClass(aChart.Canvas.ClassType);
if lCanvasClass <> TTeeCanvas3D then
aChart.Canvas := TTeeCanvas3D.Create;
lHoldGradientVisible := aChart.Gradient.Visible;
lHoldColor := aChart.Color;
lHoldBevel := aChart.BevelOuter;
lHoldShadow := aChart.Shadow.Visible;
lHoldHover := aChart.Hover.Visible;
try
SetLength(lBoolArray, aChart.SeriesCount);
for I := 0 to aChart.SeriesCount - 1 do // Iterate
if aChart.Series[I] is TPieSeries then begin
lBoolArray[I] := TPieSeries(aChart.Series[I]).Circled;
TPieSeries(aChart.Series[I]).Circled := True;
end else
lBoolArray[I] := True;
aChart.Gradient.Visible := false;
if not aTransparent then
aChart.Color := clWhite
else
aChart.Color := Graphics.clNone; //clWhite;
aChart.BevelOuter := bvNone;
aChart.BevelInner := bvNone;
aChart.Shadow.Visible := False;
aChart.Hover.Visible := false;
if aGraphic is TMetafile then begin
lMetafile := aChart.TeeCreateMetafile(false, aRect);
try
aGraphic.Assign(lMetafile);
finally
lMetafile.Free;
end;
end else begin
lBmp := aChart.TeeCreateBitmap(clWhite, aRect);
try
aGraphic.Assign(lBmp);
finally
lBmp.Free;
end;
end;
finally
aChart.Hover.Visible := lHoldHover;
aChart.Shadow.Visible := lHoldShadow;
aChart.Gradient.Visible := lHoldGradientVisible;
aChart.Color := lHoldColor;
aChart.BevelOuter := lHoldBevel;
for I := 0 to aChart.SeriesCount - 1 do // Iterate
if aChart.Series[I] is TPieSeries then
TPieSeries(aChart.Series[I]).Circled := lBoolArray[I];
if (lCanvasClass <> aChart.Canvas.ClassType) then
aChart.Canvas := lCanvasClass.Create;
if assigned(aChart.OnResize) then
WrapLeftAxisTitle(aChart, aChart.Height);
end;
end;
Ed Dressel