procedure TForm1.Button4Click(Sender: TObject); begin listBox1.Items.Add('测试aaaa'); ListBox1.ItemIndex := ListBox1.Items.Count-1; end;
procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin for i:=1 to 1000 do begin listbox1.Items.Add(inttostr(i)); listbox1.TopIndex:=i-1; //用这个 sleep(100); application.ProcessMessages; end; end;
begin
listBox1.Items.Add('测试aaaa');
ListBox1.ItemIndex := ListBox1.Items.Count-1;
end;
var
i:integer;
begin
for i:=1 to 1000 do
begin
listbox1.Items.Add(inttostr(i));
listbox1.TopIndex:=i-1; //用这个
sleep(100);
application.ProcessMessages;
end;
end;