引用CommCtrl單元
procedure TForm1.Button1Click(Sender: TObject);
begin
ListView_DeleteColumn(MyListVIEw.Handle, i);//i是要刪除的列的序號,從0開始
end;
用LISTVIEW顯示表中的信息:
procedure viewchange(listv:tlistvIEw;table:tcustomadodataset;var i:integer);
begin
tlistview(listv).Items.BeginUpdate; {listv:listvIEw名}
try
tlistvIEw(listv).Items.Clear;
with table do {table or query名}
begin
active:=true;
first;
while not eof do
begin
listitem:=tlistvIEw(listv).Items.add;
listitem.Caption:=trim(table.fIElds[i].asstring);
// listitem.ImageIndex:=8;
next;
end;
end;
finally
tlistvIEw(listv).Items.EndUpdate;
end;
end;