一个LISTVIEW只有一个OnClick事件,你可以通过单击后获得该行的索引来进行操作: if ListView1.ItemIndex>=0 then begin i:=ListView1.ItemFocused.Index;//获得索引 //然后再用类似listview1.Items[i].Caption的方法获得相关信息 end;
procedure TForm.LViewClick(Sender: TObject); begin if zbLView.Selected<>nil then begin showmessage(LView.Selected.Caption); ...... end;
if ListView1.ItemIndex>=0 then
begin
i:=ListView1.ItemFocused.Index;//获得索引
//然后再用类似listview1.Items[i].Caption的方法获得相关信息
end;
begin
if zbLView.Selected<>nil then
begin
showmessage(LView.Selected.Caption);
......
end;