Using Delphi Seattle, take the following code with a button and a label and set the Form's DoubleBuffering to True.
procedure TForm1.Button1Click(Sender: TObject);
Var a: Integer;
s: Int64;
begin
s := GetTickCount;
for a := 1 to 10000 do begin
Label1.Caption := 'Testing '+IntToStr(a);
Application.ProcessMessages;
end;
s := GetTickCount - s;
caption := inttostr(s);
end;
Besides heavy flickering, the loop takes much longer if a VCL style is used. Same happens with other controls i.e TGroupBox, TStatusBar. Updating the form Caption instead has no flickering, but it's much slower.
How can I fix the flickering?
Update from comments:
The code is just to easily reproduce the issue. The problem I encountered is in a part of large application where a file download is performed and the progress updated as the data received event is triggered, i.e " 12.05 MB / 200 MB done". The performance degrade (and flickering) is so bad with a custom VCL style on that the download was faster when on default "Windows" style.