RichViewEdit - margin - printout
Posted: Fri Nov 17, 2006 2:07 pm
Hi,
I use the paper format A4 (210 mm x 297 mm).
In my RichViewEdit i to fix the left- and right margin at 20mm:
The RVRuler in the RichViewEdit showing the margins correkt.
But the printpreview and the printout margins are approximate 25mm instead of 20mm (left-margin and right-margin).
Where is my bug?
Crowbar
I use the paper format A4 (210 mm x 297 mm).
In my RichViewEdit i to fix the left- and right margin at 20mm:
Code: Select all
...
function MMToPixels(mm: Integer): Integer;
var ppi: Integer;
begin
ppi:=RichViewPixelsPerInch;
if ppi = 0 then ppi:=Screen.PixelsPerInch;
Result:=Round(mm * 5 * ppi / 127);
end;
...
RichViewEdit1.LeftMargin:=MMToPixels(20);
RichViewEdit1.RightMargin:=MMToPixels(20);
RichViewEdit1.MaxTextWidth:=MMToPixels(210)-RichViewEdit1.LeftMargin-RichViewEdit1.RightMargin;
RichViewEdit1.Format;
...
procedure TForm1.PrintPreviewButtonClick(Sender: TObject);
begin
RVPrint1.AssignSource(RichViewEdit1);
RVPrint1.LeftMarginMM:=0;
RVPrint1.RightMarginMM:=0;
RVPrint1.TopMarginMM:=0;
RVPrint1.BottomMarginMM:=0;
RVPrint1.HeaderYMM:=0;
RVPrint1.FooterYMM:=0;
RVPrint1.FormatPages(rvdoALL);
RVPrintPreview1.First;
end;
...
But the printpreview and the printout margins are approximate 25mm instead of 20mm (left-margin and right-margin).
Where is my bug?
Crowbar