trichview.com

trichview.support




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


Return to index


Author

Message

Yernar

Posted: 04/16/2003 11:11:23


Here's the simple example:


unit main;


interface


uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  RVStyle, ExtCtrls, RVScroll, RichView, StdCtrls;


type

  TMarginForm = class(TForm)

    rv: TRichView;

    BottomPanel: TPanel;

    rvs: TRVStyle;

    MarginButton: TButton;

    MarginEdit: TEdit;

    procedure FormCreate(Sender: TObject);

    procedure MarginButtonClick(Sender: TObject);

    procedure rvPaint(Sender: TCustomRichView; Canvas: TCanvas;

      Prepaint: Boolean);

  private

  public

  end;


var

  MarginForm: TMarginForm;


implementation


{$R *.DFM}


procedure TMarginForm.FormCreate(Sender: TObject);

begin

  with rv do begin

    LeftMargin := 50;

    RightMargin := 10;

    TopMargin := 100;

    BottomMargin := 75;

    AddNL('Keden!', 0, 0);

    Format;

  end;

end;


procedure TMarginForm.MarginButtonClick(Sender: TObject);

var

  RVMargin: Integer;

begin

  RVMargin := StrToInt(MarginEdit.Text);

  with rv do begin

    LeftMargin := RVMargin;

    RightMargin := RVMargin;

    BottomMargin := RVMargin;

    TopMargin := RVMargin;

    Format;

  end;

end;


procedure TMarginForm.rvPaint(Sender: TCustomRichView; Canvas: TCanvas;

  Prepaint: Boolean);

begin

  Canvas.Pen.Style := psDashDot;

  Canvas.Brush.Color := clBlue;

  Canvas.FrameRect(Rect(rv.LeftMargin, rv.TopMargin, rv.Width - rv.RightMargin,

    rv.Height - rv.BottomMargin));

end;


end.



>Is it possible to delimit top, bottom, left and right margins with a rectangle?





Powered by ABC Amber Outlook Express Converter