Recent

Author Topic: Bitmap  (Read 1587 times)

hvh

  • New Member
  • *
  • Posts: 20
Bitmap
« 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;           

eny

  • Hero Member
  • *****
  • Posts: 1609
Re: Bitmap
« Reply #1 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;         
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

hvh

  • New Member
  • *
  • Posts: 20
Re: Bitmap
« Reply #2 on: July 01, 2015, 10:59:34 pm »
Your solution works.
Thanks for your work!

 

TinyPortal © 2005-2018