你好幸福,我前几天刚刚做完这方面的程序,给你参考一下。代码如下:
procedure TUniLane.SetptWasteView(Node:string);
var FileIni:TIniFile;
FilePath:string;
ItemList:TStrings;
I,j:Integer;
NewColumn: TListColumn;
begin
Itemlist := TStringList.Create;
FilePath:=ExtractFilePath(Application.ExeName)+'laneMon.ini';if Node='waste' then
try
if FileExists('laneMon.ini') then
begin
FileIni:=TIniFIle.Create(FilePath);
FileIni.ReadSection('waste',ItemList);
With ptWasteView,ItemList do
begin
ptWasteView.Columns.Clear;
for I:=0 to ItemList.Count-1 do
begin
With ptWasteView.Columns do
begin
NewColumn:=Columns.Add;
NewColumn.AutoSize:=True;
NewColumn.Caption:=ItemList.Strings[i];
//测试添加;2002-5-16
NewColumn.Alignment:=taCenter;
Column[0].AutoSize:=False;
Column[0].Width:=10;
end;
if FileIni.ReadString('waste',ItemList[i],'')='0' then
begin
NewColumn.Width:=0;
NewColumn.AutoSize:=False;
end;
end;
end;
end;
finally
FileIni.free;
end;
end;
procedure TUniLane.SetptWasteView(Node:string);
var FileIni:TIniFile;
FilePath:string;
ItemList:TStrings;
I,j:Integer;
NewColumn: TListColumn;
begin
Itemlist := TStringList.Create;
FilePath:=ExtractFilePath(Application.ExeName)+'laneMon.ini';if Node='waste' then
try
if FileExists('laneMon.ini') then
begin
FileIni:=TIniFIle.Create(FilePath);
FileIni.ReadSection('waste',ItemList);
With ptWasteView,ItemList do
begin
ptWasteView.Columns.Clear;
for I:=0 to ItemList.Count-1 do
begin
With ptWasteView.Columns do
begin
NewColumn:=Columns.Add;
NewColumn.AutoSize:=True;
NewColumn.Caption:=ItemList.Strings[i];
//测试添加;2002-5-16
NewColumn.Alignment:=taCenter;
Column[0].AutoSize:=False;
Column[0].Width:=10;
end;
if FileIni.ReadString('waste',ItemList[i],'')='0' then
begin
NewColumn.Width:=0;
NewColumn.AutoSize:=False;
end;
end;
end;
end;
finally
FileIni.free;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货