trichview.com

trichview.support




Re: Can we draw a rectangle to delimit every margins ?


Return to index


Author

Message

Sergey Tkachenko

Posted: 04/18/2003 15:00:30


Assign this code to OnPaint.

But, as I said, RichView.LeftMargin, RichView.TopMargin, etc. are not "real

margins". They are like additional indents to paragraphs.

Real margins are RVPriint.LeftMarginMM, RVPriint.TopMarginMM, etc. They are

not shown in editor, they can be shown on preview by assigning MarginsPen.


procedure TForm3.RichViewEdit1Paint(Sender: TCustomRichView;

  Canvas: TCanvas; Prepaint: Boolean);

var r: TRect;

begin

  Canvas.Pen.Style := psSolid;

  Canvas.Pen.Color := clRed;

  Canvas.Brush.Style := bsClear;

  // rectangle around document, excluding margins

  r := Rect(Sender.LeftMargin, Sender.TopMargin,

    Sender.RVData.DocumentWidth+Sender.LeftMargin,

    Sender.DocumentHeight-Sender.BottomMargin);

  // taking scrolling into account

  OffsetRect(r, -Sender.HScrollPos, -Sender.VScrollPos*Sender.VSmallStep);

  // avoiding huge coordinates

  if r.Top<0 then

    r.Top := -10;

  if r.Bottom>Sender.Height then

    r.Bottom := Sender.Height+10;

  // drawing

  Canvas.Rectangle(r);

end;



> Hi Sergey,

>

> Thanks you so much for your help. In your message, you said you could give

> me an exemple of the margins rectangle.

>

> I'd like to get it please that will be so helpfull to me

>

> peace,

> Jeffoule

>

>

> "Sergey Tkachenko" <svt@trichview.com> wrote:

> >There are two kinds of margins in RichView:

> >(1) margins on page (properties of TRVPrint), not shown in editor; they

> are

> >"real margins"

> >(2) margins-properties of RichView; they can be considered as additional

> >paragraph indents

> >See the help topic on TRVPrint for illustrations.

> >

> >If you want to show margins (1) , just set RVPrint.Margins.Pen.Style to

> >psSolid (or other style different from psClear).

> >If you want to show margins (2), see Yernar's code (with some

corrections:

> >margins are applied to the document, not to window - scrolling must be

taken

> >into account; I can give you an example, if you want)

> >

> >

>





Powered by ABC Amber Outlook Express Converter