小技巧 (2001年5月30日).txt

来自「自己对DELPHI学习的一点体会」· 文本 代码 · 共 40 行

TXT
40
字号
小技巧 (2001年5月30日) 

网友更新  分类:控件使用   作者:阎磊  推荐:yanlei   阅读次数:491  
(http://www.codesky.net)  

--------------------------------------------------------------------------------
我们为了将hint显示在StatusBar1上需要如下方法
public
procedure DisplayHint(Sender: TObject);
end;

var

Form1: TForm1;
implementation
{$R *.DFM}

{ Here is the implementation of the OnHint event handler }

{ It displays the application抯 current hint in the status bar }
procedure TForm1.DisplayHint(Sender: TObject);
begin
StatusBar1.SimpleText := Application.Hint;
end;

{ Here is the form抯 OnCreate event handler. }

{ It assign抯 the application抯 OnHint event handler at runtime }
{ because the Application is not available in the Object Inspector }
{ at design time }
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnHint := DisplayHint;
end;
其实只需要将
StatusBar1.autohint:=true
即可完成
 
 

⌨️ 快捷键说明

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