unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
mmo1: TMemo;
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
FormOldWid:Integer ;//保存原来的窗体宽度
implementation
{$R *.dfm}
procedure TForm1.FormResize(Sender: TObject);
begin
if FormOldWid>0 then
begin
ScaleBy(self.Width,FormOldWid);//起作用的主要函数
FormOldWid:=self.Width;
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
showmessage(inttostr(self.Width));
FormOldWid:=self.Width;//保存初始窗体宽度。
end;
end.