inplementation const ScreenWidth: LongInt = 1024; {I designed my form in 1024×768 mode.} ScreenHeight: LongInt = 768;{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject); begin scaled := true; if (screen.width <> ScreenWidth) then begin height := longint(height) * longint(screen.height) div ScreenHeight; width := longint(width) * longint(screen.width) div ScreenWidth; scaleBy(screen.width, ScreenWidth); end; end;下一步,要每個子控制的字体改變到合适的大小: type TFooClass = class(TControl); { needed to get at protected } { font property }var i: integer; begin for i := ControlCount - 1 downto 0 do TFooClass(Controls[i]).Font.Size := (NewFormWidth div OldFormWidth) * TFooClass(Controls[i]).Font.Size; end;
for i:=0 to self.ComponentCount-1 do if self.Components[i] is TButton then (Components[i] as TButton).Width := (Components[i] as TButton).Width +10;这样就把所有的Button的Width都加了10,用这种方法一类一类的处理就可以了
const
ScreenWidth: LongInt = 1024; {I designed my form in 1024×768 mode.}
ScreenHeight: LongInt = 768;{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
begin
scaled := true;
if (screen.width <> ScreenWidth) then
begin
height := longint(height) * longint(screen.height) div ScreenHeight;
width := longint(width) * longint(screen.width) div ScreenWidth;
scaleBy(screen.width, ScreenWidth);
end;
end;下一步,要每個子控制的字体改變到合适的大小:
type
TFooClass = class(TControl); { needed to get at protected }
{ font property }var
i: integer;
begin
for i := ControlCount - 1 downto 0 do
TFooClass(Controls[i]).Font.Size :=
(NewFormWidth div OldFormWidth) *
TFooClass(Controls[i]).Font.Size;
end;
if self.Components[i] is TButton then
(Components[i] as TButton).Width := (Components[i] as TButton).Width +10;这样就把所有的Button的Width都加了10,用这种方法一类一类的处理就可以了
[email protected]
我也要。谢谢
这个控键能在D2006中用吗?
[email protected]
[email protected]
谢谢