Redrawing form lazarus / 39-Graphics ---------------------------------------------------------------------- pascal111 · 2021-04-21 01:38 I'm trying in the next piece of code to delay the drawing of line of pixels to see some motion, but I failed to make the form to redraw itself again each determined time of "delay" procedure: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormPaint(Sender: TObject);var   i:integer; begin     for i:=1 to 100 do  begin     canvas.Pixels[i,10]:=clblue;    self.update;    delay(100);   end;     end; ---------------------------------------------------------------------- engkin · 2021-04-21 02:11 After delay call Application.ProcessMessages. The correct way is to use a timer. If you draw on the form, it will not retain the image when covered with some other window. ---------------------------------------------------------------------- engkin · 2021-04-21 02:59 Check attached project ---------------------------------------------------------------------- pascal111 · 2021-04-21 11:25 I made some changes depending on attached project "simple", and it works. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  var  Form1: TForm1;  x:integer;      procedure TForm1.FormPaint(Sender: TObject); begin       canvas.Pixels[x,10]:=clblue;   end; procedure TForm1.Timer1Timer(Sender: TObject);  begin   if x>=100 then  exit  else    inc(x);     Invalidate;  end;             With modifying "interval" property of the timer.