unit OnResize;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormResize(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: OnResize
// Event: Controls.TControl.OnResize

// BeginCode
{
The following code keeps the right edge on Button1 against
the right edge of Form1 when Form1 is resized.
} 
procedure TForm1.FormResize(Sender: TObject);
begin
  Button1.Left := Form1.ClientWidth-Button1.Width;
end;
// EndCode
// EndExample: OnResize
end.
