Hi,
I know how to dipslay margins in the Previewer with different pen types etc, but, is it possible to achieve the same effect or similar in the Editor.
TIA
Mark Bailey
Margins
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Sorry, I missed this question.
Editor has LeftMargin, TopMargin, RightMargin, BottomMargin. They can be shown using OnPaint event.
In addition to them, TRVPrint has LeftMarginMM, TopMarginMM, RightMarginMM, BottomMarginMM (see the sheme in the help topic about TRVPrint). They canot be shown in editor because editor does not have these margins.
Code showing left and right margins in editor:
This code draws 3 vertical lines.
2 gray dotted lines show margins.
Black line shows the right border of the document. It should be visible only if the document width is limited by MaxTextWidth property.
Editor has LeftMargin, TopMargin, RightMargin, BottomMargin. They can be shown using OnPaint event.
In addition to them, TRVPrint has LeftMarginMM, TopMarginMM, RightMarginMM, BottomMarginMM (see the sheme in the help topic about TRVPrint). They canot be shown in editor because editor does not have these margins.
Code showing left and right margins in editor:
Code: Select all
procedure TForm1.rvePaint(Sender: TCustomRichView; Canvas: TCanvas;
Prepaint: Boolean);
var x: Integer;
begin
Canvas.Pen.Style := psDot;
Canvas.Pen.Width := 1;
Canvas.Pen.Color := clBtnShadow;
x := Sender.LeftMargin-Sender.HScrollPos;
Canvas.MoveTo(x, 0);
Canvas.LineTo(x, Sender.Height);
inc(x,Sender.RVData.TextWidth);
Canvas.MoveTo(x, 0);
Canvas.LineTo(x, Sender.Height);
Canvas.Pen.Color := clBlack;
Canvas.Pen.Style := psSolid;
inc(x, Sender.RightMargin);
Canvas.MoveTo(x, 0);
Canvas.LineTo(x, Sender.Height);
end;
2 gray dotted lines show margins.
Black line shows the right border of the document. It should be visible only if the document width is limited by MaxTextWidth property.