delphi treeview 鼠标移动显示hint信息

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信息,布布扣,bubuko.com

delphi treeview 鼠标移动显示hint信息

上一篇:在APP中集成iAd Banner展示广告盈利


下一篇:5.8mm:最薄八核手机曝光