ListView中 如何得到选中列的caption,这个能实现吗?
ListView中 如何得到选中列的caption,这个能实现吗?我得到选中行的caption,可以是ListView1.Selected.Caption 那选中列的caption能得到吗 ?先谢过了
[解决办法]
ListView1.Selected.SubItems[0]
[解决办法]
ListView根本就不存在选中第二列,要么选中第一列,要么选中行。
listview1.columns.items[0].caption
这个就能表示每列的标题
[解决办法]
procedure TForm1.ListView1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
i, X1, X2: integer;
begin
X1 := 0;
X2 := 0;
for i := 0 to ListView1.Columns.Count - 1 do
begin
X2 := X2 + ListView1.Column[i].Width;
if (X > X1) and (X <= X2) then
begin
Memo1.Lines.Add(ListView1.Column[i].Caption);
Break;
end;
X1 := X2;
end;
end;