Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: hvh on June 30, 2015, 10:21:37 pm

Title: Bitmap
Post by: hvh on June 30, 2015, 10:21:37 pm
Yust a simple test procdure
I want the image to change color each time in the loop.
But it shows only the color of the last run.
How should I manage this.

procedure TForm1.VulRechthoek(Sender: TObject);
var I     :Integer;
begin
  for I := 1 to 10 do begin
    Memo1.Lines.Add('Tekst');
    Sleep(500);
    MyBitmap.Canvas.Brush.Color  := 92000+10*I;
    MyBitmap.Canvas.Fillrect(0,0,MyBitmap.Width,MyBitmap.Height);
    Image1.Canvas.Draw( 0, 0, MyBitmap);
  end;
end;           
Title: Re: Bitmap
Post by: eny on June 30, 2015, 10:34:20 pm
Code: [Select]
procedure TForm1.VulRechthoek(Sender: TObject);
var I     :Integer;
begin
  for I := 1 to 10 do begin
    Memo1.Lines.Add('Tekst');
    MyBitmap.Canvas.Brush.Color  := 92000+10*I;
    MyBitmap.Canvas.Fillrect(0,0,MyBitmap.Width,MyBitmap.Height);
    Image1.Canvas.Draw( 0, 0, MyBitmap);
    Application.ProcessMessages;        // <--------------------
    Sleep(500);
  end;
end;         
Title: Re: Bitmap
Post by: hvh on July 01, 2015, 10:59:34 pm
Your solution works.
Thanks for your work!
TinyPortal © 2005-2018