procedure TForm1.TreeView1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
Node: TTreeNode;
begin
with TreeView1 do
begin
Node := GetNodeAt(X, Y);
ShowHint := (Node <> nil);
if ShowHint then
begin
Hint := Node.Text;
Application.ActivateHint(Mouse.CursorPos);
end;
end;
end;
//OR
procedure TForm1.TreeView1MouseMove(Sender: TObject; Shift: TShiftState;
X,
Y: Integer);
{$J+}
const
OldItem: TTreeNode =
nil;
{$J-}
var
AnItem: TTreeNode;
begin
AnItem :=
TTreeView(Sender).GetNodeAt(X, Y);
if Assigned(AnItem) and (AnItem
<> OldItem) then begin
TTreeView(Sender).Hint :=
AnItem.Text;
Application.ActivateHint(Mouse.CursorPos);
OldItem :=
AnItem;
end;
end;
来源: <delphi treeview 鼠标移动显示hint信息_妙馨_新浪博客>
delphi treeview 鼠标移动显示hint信息,布布扣,bubuko.com
时间: 2024-10-21 17:54:56