hi,
I am adding text to the chart on the AfterDraw event. when printing the text is realy oversized unless I select the smooth checkbox in the preview dialog. How can this be fixed and how are printing properties such as Smooth set with code.
here is the Afterdraw code in case needed
sorry for the formatting...
Thanks
SavedFont:= TFont.Create;
try
SavedFont.Assign(ChartAnalysis.Canvas.Font);
for i:= 0 to DataFile.NumSensors - 1 do
begin
aSerie := FastLineSeries(FindComponent(DataFile.Sensors.SensorInfo.siName));
if ((aSerie = nil) or (aSerie.Visible = false)) then
Continue;
XPos:= aSerie.GetHorizAxis.IEndPos + 5;
YPos:= aSerie.CustomVertAxis.IStartPos;
if (FCalcResultUseSeriesColor = true) then
ChartAnalysis.Canvas.Font.Color:= aSerie.Color;
ChartAnalysis.Canvas.Font.Name:= 'courier new';
ChartAnalysis.Canvas.Font.Size:= 8;
aStr:= '000.0 000.0';
ChartAnalysis.Canvas.TextOut(XPos, YPos, aStr);
aStr:= '000.0 000.0 000.0';
YPos := aSerie.CustomVertAxis.IStartPos +
((aSerie.CustomVertAxis.IEndPos -
aSerie.CustomVertAxis.IStartPos) div 2) + 2;
ChartAnalysis.Canvas.TextOut(XPos, YPos, aStr);
end;
finally
ChartAnalysis.Canvas.Font.Assign(SavedFont);
SavedFont.Free;
end;
Printing & Chart AfterDraw strange behavior
Hi Marc,
the problem is you're using Canvas.Font.Size to set font "size", when printing, you should always use Font.Height instead of Font.Size.
Something like this (placed in TChart OnAfterDraw event) should work:
Chart1.Canvas.Font.Height = -13; // note the - sign!
Chart1.Canvas.TextOut(100,100,'Hello World');
the problem is you're using Canvas.Font.Size to set font "size", when printing, you should always use Font.Height instead of Font.Size.
Something like this (placed in TChart OnAfterDraw event) should work:
Chart1.Canvas.Font.Height = -13; // note the - sign!
Chart1.Canvas.TextOut(100,100,'Hello World');
Pep Jorge
http://support.steema.com
http://support.steema.com