把界面上的控件的 Anchors 属性设置全部选上(打钩),比如一个Button,把Anchors 属性全部打钩,就能随着窗体的缩放而缩放了,希望是你想要的答案
按比例缩放窗体和全部控件
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Edit1: TEdit;
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
private
OldWidth:Integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormResize(Sender: TObject);
begin
form1.ScaleBy(Self.Width,OldWidth);
OldWidth:=Self.width;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
OldWidth:=Self.width;
end;
end.