拷贝于我的一段程序:
procedure TResBroker.ResDrawListViewColumns(Node: TTreeNode; ListView: TListView);
var
NewColumn: TListColumn;
begin
with ListView do
begin
Columns.BeginUpdate;
Columns.Clear;
if TResCls(Node.Data).ResVRFlag = 'F' then
begin
NewColumn := Columns.Add;
NewColumn.Width := 180;
NewColumn.Caption := '名称';
NewColumn := Columns.Add;
NewColumn.Width := 110;
NewColumn.Caption := '代码';
NewColumn := Columns.Add;
NewColumn.Width := 70;
NewColumn.Caption := '分组/实类';
NewColumn := Columns.Add;
NewColumn.Width := 70;
NewColumn.Caption := '模式';
NewColumn := Columns.Add;
NewColumn.Width := 160;
NewColumn.Caption := '视图';
NewColumn := Columns.Add;
NewColumn.Width := 160;
NewColumn.Caption := '备注';
end
else if TResCls(Node.Data).ResVRFlag = 'T' then
begin
NewColumn := Columns.Add;
NewColumn.Width := 180;
NewColumn.Caption := '名称';
NewColumn := Columns.Add;
NewColumn.Width := 110;
NewColumn.Caption := '代码';
NewColumn := Columns.Add;
NewColumn.Width := 80;
NewColumn.Caption := '是否有效';
NewColumn := Columns.Add;
NewColumn.Width := 60;
NewColumn.Caption := '扩展标志';
NewColumn := Columns.Add;
NewColumn.Width := 140;
NewColumn.Caption := '备注';
end;
Columns.EndUpdate;
end;
end;