function TCustomAction.DoHint(var HintStr: string): Boolean; begin Result := True; if Assigned(FOnHint) then FOnHint(HintStr, Result); end;其实HINT属性无非是要SHOWHINT的,而就要用到DOHINT,但具体任何实现我也不清楚。
Occurs when the mouse pauses over a client control or menu item.type THintEvent = procedure (var HintStr: String; var CanShow: Boolean) of object; property OnHint: THintEvent;只知道这些了!
查查forms.pas,看看到底是怎么实现的。
麻烦呀,还不如继承呢。
begin
Result := True;
if Assigned(FOnHint) then FOnHint(HintStr, Result);
end;其实HINT属性无非是要SHOWHINT的,而就要用到DOHINT,但具体任何实现我也不清楚。
property OnHint: THintEvent;只知道这些了!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
a = procedure;
pa = ^a;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
CustomHint: THintWindow;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
Self.CustomHint := THintWindow.Create(Self);
Self.CustomHint.Parent := Self;
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
Self.CustomHint.Free;end;procedure TForm1.Button1Click(Sender: TObject);
var
Pt: TPoint;
begin
Self.CustomHint.Caption := Self.Edit1.Text;
GetCursorPos(Pt);
Self.CustomHint.Top := Pt.Y;
Self.CustomHint.Left := Pt.X;
Self.CustomHint.Show;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
Self.CustomHint.Hide;
end;end.
a = procedure;
pa = ^a;
这几行不要用。呵...这只是一个显示提示的程序。而其它的就用一个最简单的方法就是判断鼠标事件,也可以用其它的方法..