关于progressbar的问题?(10分)

S

sxd2002

Unregistered / Unconfirmed
GUEST, unregistred user!
begin
if fileexists('c:/temp/aaa.txt') then begin
FlatButton2.Enabled:=false;
Screen.Cursor:=CrhourGlass;
adotable1.Connection:=ADOConnection1;
adotable1.TableName:='tzdb';
adotable1.Active:=true;
adotable1.Edit;
lines:=Tstringlist.Create;
lines.LoadFromFile('c:/temp/aaa.txt');
for i:=0 to pred(lines.Count-1) do begin
adotable1.Append;
s:=lines;
s2:=copy(s,10,16);
adotable1.FieldByName('xh').Value:=s2;
s2:=copy(s,29,6);
adotable1.FieldByName('xm').Value:=s2;
s2:=copy(s,72,14);
adotable1.FieldByName('dfe').Value:=s2;
s2:=copy(s,97,8);
adotable1.FieldByName('fdz').Value:=s2;
...
******************************************************
由于aaa.txt的行数很长,在append的时候时间较长,我想用
progressbar显示完成的进度,由于本人对progressbar很陌生
请高手给点源码;或者还有什么好的进度显示方法;
 
1、设置初始0,每次+10,最后设置为100即可
2、计算总数,每次+10/count最后100
 
源码?????
 
控件拦里win32页有TProgressBar

其有max,min,position属性
你可以设置其max属性
然后用方法来增加显示:
1)ProgressBar1.Position:=ProgressBar1.Position+1;
2)ProgressBar1.Stepit;
 
针对上面的代码,你能否给出怎么付值max,min,position
ProgressBar的position怎么随i的变化而变化
 
begin
if fileexists('c:/temp/aaa.txt') then begin
FlatButton2.Enabled:=false;
Screen.Cursor:=CrhourGlass;
adotable1.Connection:=ADOConnection1;
adotable1.TableName:='tzdb';
adotable1.Active:=true;
adotable1.Edit;
lines:=Tstringlist.Create;
lines.LoadFromFile('c:/temp/aaa.txt');
ProgressBar1.max:=lines.count; //
ProgressBar1.step:1; //
ProgressBar1.Position:=0;//
for i:=0 to pred(lines.Count-1) do begin
adotable1.Append;
ProgressBar1.Stepit;//
s:=lines;
s2:=copy(s,10,16);
adotable1.FieldByName('xh').Value:=s2;
s2:=copy(s,29,6);
adotable1.FieldByName('xm').Value:=s2;
s2:=copy(s,72,14);
adotable1.FieldByName('dfe').Value:=s2;
s2:=copy(s,97,8);
adotable1.FieldByName('fdz').Value:=s2;
...
 
顶部