Delphi如何知道ListView中鼠标下是哪项

来源:百度知道 编辑:UC知道 时间:2024/09/22 18:50:53
就是:把鼠标移到ListView的一项,怎么获得那一项的Index,注意那一项可以不选中,ItemIndex也不动.

procedure TForm2.lv1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if lv1.GetItemAt(x,y)<>nil then
Caption:=lv1.GetItemAt(x,y).Caption;
end;

listview1.GetItemAt(x,y).index //x,y是座标
用这个应该可以搞定的