Put a Shap on one band, and a Line on another band. Both Left property values are the same. But they can't align by left side when printing to a paper.(Preview is fine) How to correct it ? Thanks for your help and Merry X'mas. Peter
This is a known problem, wher ethe shapes and lines don' t line up. If you look at the draw command left property values, you'll see that they are different, between the line and the shape. The reason is we use the Pen to draw the line around the shape. The problem is that the pen draws along a center line. If the pen is say, 5 pixels in width, then there will be 2 pixels on the left of the center line and 2 on the right of the center line. I think the behavior we're seeing is that the pen is drawing just one pixel to the left of where it should be.
You may be able to use the OnEndPage event ot modify the draw command, by checking if the Report.DeviceType is printer, and then add a microns measuremnt to the left value of the DrawShape command's left property. We'll see if we can work out a better solution in the meantime.
It looks like it is one pixel off on the shape, as I grabbed a handle to the draw shape in its OnDrawCommandCreate event and added a value of 1 pixel to it in the Report.OnEndPage event.
Comments
look at the draw command left property values, you'll see that they are
different, between the line and the shape. The reason is we use the Pen to
draw the line around the shape. The problem is that the pen draws along a
center line. If the pen is say, 5 pixels in width, then there will be 2
pixels on the left of the center line and 2 on the right of the center line.
I think the behavior we're seeing is that the pen is drawing just one pixel
to the left of where it should be.
You may be able to use the OnEndPage event ot modify the draw command, by
checking if the Report.DeviceType is printer, and then add a microns
measuremnt to the left value of the DrawShape command's left property.
We'll see if we can work out a better solution in the meantime.
It looks like it is one pixel off on the shape, as I grabbed a handle to the
draw shape in its OnDrawCommandCreate event and added a value of 1 pixel to
it in the Report.OnEndPage event.
Thanks for reporting the issue.
uses
ppDRwCmd, ppTypes, ppUtils;
....
procedure TForm1.ppShape1DrawCommandCreate(Sender, aDrawCommand: TObject);
begin
FShape := TppDrawShape(aDrawCommand);
end;
procedure TForm1.ppReport1EndPage(Sender: TObject);
begin
if (ppReport1.DeviceType = dtPrinter) then
FShape.Left := FShape.Left + ppToMMThousandths(1, utScreenPixels,
pprtHorizontal, ppReport1.Printer)
end;
Happy Holidays,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com