(转载)在状态栏即时显示Hint

在状态栏即时显示Hint(所有窗口,包括子窗口控件的hint)

在主窗体中放入一个ApplicationEvents控件。
添加如下代码。
其中Items[***]中的***代表状态栏的各个子panel,integer类型。

procedure TfrmMain.ApplicationEvents1Hint(Sender: TObject);
begin
statusbar1.Panels.Items[nInfo].Text:=Application.Hint;
end;

procedure TfrmMain.ApplicationEvents1Idle(Sender: TObject;
var Done: Boolean);
begin
if odd(GetKeyState(VK_CAPITAL)) then
statusbar1.Panels.Items[nCaps].text:='大写'
else
statusbar1.Panels.Items[nCaps].text:='';

if odd(GetKeyState(VK_NUMLOCK)) then
statusbar1.Panels.Items[nNum].text:='数字'
else
statusbar1.Panels.Items[nNum].text:='';

statusbar1.Panels.Items[nTime].text:=
formatdatetime('yyyy-mm-dd hh:mm',now);

end;

原文地址:https://www.cnblogs.com/angelbd/p/3373078.html