draw lines

General TRichView support forum. Please post your questions here
Post Reply
krctech
Posts: 7
Joined: Tue Jun 03, 2008 4:57 am
Location: San Diego, CA US

draw lines

Post by krctech »

I want to be able to draw a border around the page at the margins. Simply a 1-pixel, solid black border. It's not obvious to me how this done. My document is simply a 1 page report (possible 2 page) but the customer wants this feature.
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I am sorry for the delay.
If you use TRVPrint for printing, use OnPagePostPaint event:

Code: Select all

procedure TForm1.RVPrint1PagePostpaint(Sender: TRVPrint; PageNo: Integer;
  Canvas: TCanvas; Preview: Boolean; PageRect, PrintAreaRect: TRect);
begin
  Canvas.Pen.Color := clBlack;
  Canvas.Pen.Width := Canvas.Font.PixelsPerInch div 96;
  Canvas.Pen.Style := psInsideFrame;
  Canvas.Brush.Style := bsClear;
  with PrintAreaRect do
    Canvas.Rectangle(Left, Top, Right, Bottom);
end;
Post Reply