// 在列表中增加一列头
procedure ListAddColumn(const AColumnCpation: string; AListView: TListView);
begin
if Assigned(AListView) then
AListView.Columns.Add.Caption := AColumnCpation;
end;
// 在列表中增加一行
procedure ListAddLine(const Args: array of string; AListView: TListView);
var
I: Integer;
begin
if High(Args) < 0 then
Exit;
with AListView.Items.Add do
begin
Caption := Args[0];
for I := Low(Args) + 1 to High(Args) do
begin
SubItems.Add(Args[I]);
end;
end;
end;
// 在列表中增加一行, 多类型版
procedure ListAddLineT(const Args: array of const; AListView: TListView);
var
I: Integer;
S: string;
begin
with AListView.Items.Add do
begin
for I := Low(Args) to High(Args) do
begin
case Args[I].VType of
vtInteger:
S := IntToStr(Args[I].VInteger);
vtBoolean:
if Args[I].VBoolean then
S := '1'
else
S := '0';
vtChar:
S := Args[I].VChar;
vtExtended:
S := FloatToStr(Args[I].VExtended^);
vtString, vtAnsiString:
S := Args[I].VString^;
vtWideChar:
S := Args[I].VWideChar;
else
S := 'UnKnown Type';
end;
if I = 0 then
Caption := S
else
SubItems.Add(S);
end;
end;
end;