📄 uscale.pas
字号:
unit Uscale;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TScaleForm = class(TForm)
Bevel1: TBevel;
Label1: TLabel;
Label2: TLabel;
Edit: TEdit;
OKButton: TButton;
CancelButton: TButton;
HelpButton: TButton;
procedure OKButtonClick(Sender: TObject);
procedure HelpButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ScaleForm: TScaleForm;
implementation
uses MainForm, utils;
{$R *.DFM}
function GetScaleSize(Size:Integer;Scale:Single):Integer;
var
New:Single;
begin
New:= Size * Scale;
Result:= Trunc(New);
end;
procedure TScaleForm.OKButtonClick(Sender: TObject);
var
I:Integer;
Scale:Single;
Form:TForm;
begin
Scale:= StrToInt(Edit.Text)/100;
Form:= FMainForm.ActiveForm;
for I:=0 to Form.ComponentCount - 1 do begin
if Form.Components[I] is TControl then begin
TControl(Form.Components[I]).Left:=
GetScaleSize(TControl(Form.Components[I]).Left, Scale);
TControl(Form.Components[I]).Top:=
GetScaleSize(TControl(Form.Components[I]).Top, Scale);
TControl(Form.Components[I]).Width:=
GetScaleSize(TControl(Form.Components[I]).Width, Scale);
TControl(Form.Components[I]).Height:=
GetScaleSize(TControl(Form.Components[I]).Height, Scale);
end;
end;
end;
procedure TScaleForm.HelpButtonClick(Sender: TObject);
begin
ShowKeywordHelp('Scale command');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -