util.pas

来自「《Delphi深度历险》附书源码 Delphi学习书本」· PAS 代码 · 共 37 行

PAS
37
字号
unit util;

interface

uses Controls, Forms, Windows;

procedure EnableControl(AControl: TControl; Enable: Boolean);
procedure MsgBox(const Msg: string);
procedure ErrBox(const Msg: string);

implementation

procedure EnableControl(AControl: TControl; Enable: Boolean);
var
  I: Integer;
begin
  AControl.Enabled := Enable;
  if AControl is TWinControl then
   with TWinControl(AControl) do
   begin
     for I := 0 to ControlCount-1 do
       EnableControl(Controls[I], Enable);
   end;
end;

procedure MsgBox(const Msg: string);
begin
  Application.MessageBox(PChar(Msg), PChar(Application.Title), MB_ICONINFORMATION);
end;

procedure ErrBox(const Msg: string);
begin
  Application.MessageBox(PChar(Msg), PChar(Application.Title), MB_ICONERROR);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?