楼上各位,多谢关心! 我在delphi的帮助里找到了这样一个例子,但是实际上仍然是控件必须首先获得焦点。 另外,不好意思,请问VSaber一个很菜的问题:在delphi里如何写application的OnHint事件,抑或在delphi里如何写application的事件,我现在只知道手工添加procedure或者在控件的事件栏里双击相应事件添加procedure。 ----------------------------------------------- delphi帮助中的例子: ======================== type TForm1 = class(TForm) Button1: TButton; StatusBar1: TStatusBar; Edit1: TEdit; procedure FormCreate(Sender: TObject); private { Private declarations } 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 := GetLongHint(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;
Self.Caption:=(Sender as TContorl).Hint;
然后将所有控件的onmousemove 指向该控件的onmousemove事件
应该是处理application的OnHint事件:
Caption := application.hint;
我在delphi的帮助里找到了这样一个例子,但是实际上仍然是控件必须首先获得焦点。
另外,不好意思,请问VSaber一个很菜的问题:在delphi里如何写application的OnHint事件,抑或在delphi里如何写application的事件,我现在只知道手工添加procedure或者在控件的事件栏里双击相应事件添加procedure。
-----------------------------------------------
delphi帮助中的例子:
========================
type
TForm1 = class(TForm)
Button1: TButton;
StatusBar1: TStatusBar;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
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 := GetLongHint(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;
再additional页下的tapplicationevent控件!