Einzelnen Beitrag anzeigen

Eppos

Registriert seit: 7. Aug 2006
Ort: Heilbronn
523 Beiträge
 
Delphi 11 Alexandria
 
#1

Warum dauert CB.ITEMS := aStringList so lange?

  Alt 24. Feb 2022, 08:17
Hallo zusammen,

entweder ich stehe auf dem Schlauch oder es liegt etwas anderes in der Luft.
Kann mir jemand erklären, warum dies 300ms dauert?
Delphi-Quellcode:
procedure TForm2.FormShow(Sender: TObject);
var aStringList : TStringList;
    i : Integer;
begin
  aStringList := TStringList.Create;
  for i:=0 to 1000 do begin
    aStringList.Add( IntToStr(i) );
  end;
  Memo1.Lines.Add( FormatDateTime('dd.mm.yyyy hh:nn:ss.zzz',now) + 'Items := aStringList START' );
  ComboBox1.Items.BeginUpdate;
  ComboBox1.Items := aStringList;
  ComboBox1.Items.EndUpdate;
  ComboBox2.Items.BeginUpdate;
  ComboBox2.Items := aStringList;
  ComboBox2.Items.EndUpdate;
  Memo1.Lines.Add( FormatDateTime('dd.mm.yyyy hh:nn:ss.zzz',now) + 'Items := aStringList STOP' );
  aStringList.Free;
end;
Gruß
Eppos
  Mit Zitat antworten Zitat