scaled print
Posted: Mon Oct 27, 2008 1:12 pm
I have to print a chart in a defined horizontal and vertical scale. My experiments have all a defference (for example if the horizontal axis should have a length of 30 centimeters I will get a length of 29 centimeters and for the vertical axis I should have a length of 21.5 centimeters I 'll get a length of 22 centimeters.
Here is a part of the code:
PrinterPixPerInchX:=GetDeviceCaps(Printer.Handle,LogPixelsX);
PrinterPixPerInchY:=GetDeviceCaps(Printer.Handle,LogPixelsY);
iWidth:= ...; {Length horizontal axis in pixel}
iHeight:=...; {Length vertical axis in pixel}
Chart1.Axes.Top.IAxisSize:=iWidth;
Chart1.Axes.Left.IAxisSize:=iHeight;
Chart1.MarginUnits:=muPixels;
iWidth:=iWidth+Chart1.MarginLeft+Chart1.MarginRight;
iHeight:=iHeight+Chart1.MarginTop+Chart1.MarginBottom;
PR.Left:=0;
PR.Top:=trunc((Printer.PageHeight-iHeight)/2);
PR.Right:=iWidth;
PR.Bottom:=PR.Top+iHeight;
Printer.Orientation:=poLandscape;
Printer.Title:=SEGY.Filename;
try
Printer.BeginDoc;
except
Printer.EndDoc;
end;
try
Chart1.PrintPartial(PR);
finally
Printer.EndDoc;
end;
Where is the problem?
Thanks for your effort!
Roland
Here is a part of the code:
PrinterPixPerInchX:=GetDeviceCaps(Printer.Handle,LogPixelsX);
PrinterPixPerInchY:=GetDeviceCaps(Printer.Handle,LogPixelsY);
iWidth:= ...; {Length horizontal axis in pixel}
iHeight:=...; {Length vertical axis in pixel}
Chart1.Axes.Top.IAxisSize:=iWidth;
Chart1.Axes.Left.IAxisSize:=iHeight;
Chart1.MarginUnits:=muPixels;
iWidth:=iWidth+Chart1.MarginLeft+Chart1.MarginRight;
iHeight:=iHeight+Chart1.MarginTop+Chart1.MarginBottom;
PR.Left:=0;
PR.Top:=trunc((Printer.PageHeight-iHeight)/2);
PR.Right:=iWidth;
PR.Bottom:=PR.Top+iHeight;
Printer.Orientation:=poLandscape;
Printer.Title:=SEGY.Filename;
try
Printer.BeginDoc;
except
Printer.EndDoc;
end;
try
Chart1.PrintPartial(PR);
finally
Printer.EndDoc;
end;
Where is the problem?
Thanks for your effort!
Roland