📄 mainform.pas
字号:
unit MainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, ComCtrls;
const
UM_CONNECT = WM_USER + 101;
type
TfrmMain = class(TForm)
StatusBar1: TStatusBar;
pnlConnections: TPanel;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
FConnections: Integer;
procedure UMConnect(var Msg: TMessage); message UM_CONNECT;
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
resourcestring
SOneConnection = '1 Connection';
SConnections = '%d Connections';
SHeapAllocated = '%s bytes allocated';
{$R *.dfm}
{ TfrmMain }
procedure TfrmMain.UMConnect(var Msg: TMessage);
begin
Inc(FConnections, Msg.WParam);
if FConnections = 1 then
pnlConnections.Caption := SOneConnection
else
pnlConnections.Caption := Format(SConnections, [FConnections]);
end;
procedure TfrmMain.Timer1Timer(Sender: TObject);
var
HS: THeapStatus;
begin
HS := GetHeapStatus;
StatusBar1.SimpleText := Format(SHeapAllocated,
[FloatToStrF(HS.TotalAllocated, ffNumber, 10, 0)]);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -