TSRichViewEdit.OnMarginsChanged

<< Click to display table of contents >>

TSRichViewEdit.OnMarginsChanged

Occurs before margins are changed.

type

   TSRVMarginsChangedEvent = procedure(Sender: TSRichViewEdit;

     var NewLeft, NewTop, NewRight, NewBottom : Integer;

     OldLeft, OldTop, OldRight, OldBottom : Integer) of object;

 

property OnMarginsChanged : TSRVMarginsChanged;

NewLeft, NewTop, NewRight, NewBottom – new margins, pixels.

OldLeft, OldTop, OldRight, OldBottom – old margins, pixels.

Unlike values of LeftMarginPix, TopMarginPix, RightMarginPix, BottomMarginPix properties, these parameters contain unscaled values (as if ViewProperty.ZoomPercent=100).

If one of Old*** parameters is equal to -1, this margin was not changed; the corresponding New*** parameter must be ignored.

If you assign -1 to one of New*** parameters, this margin will not be changed.

This event occurs:

when assigning new values to LeftMargin, RightMargin, TopMargin, BottomMargin properties of PageProperty, or

when calling SetMargin, SetMarginMM or SetMarginUnit methods.

Example:

// SRVPrint: TSRVPrint is placed on the form

procedure TForm1.SRichViewEdit1MarginsChanged(

  Sender: TSRichViewEdit; var NewLeft, NewTop, NewRight,

  NewBottom: Integer; OldLeft, OldTop, OldRight, OldBottom: Integer);

var

  ValueLeft, ValueRight, ValueTop, ValueBottom : Integer;

begin

  if SRVPrint1.CheckMargin(ValueLeft, ValueTop, ValueRight, ValueBottom,

    NewLeft, NewTop, NewRight, NewBottom) then begin

    NewLeft := ValueLeft;

    NewTop := ValueTop;

    NewRight := ValueRight;

    NewBottom := ValueBottom;

  end;

end;