[Lazarus] TImage at runtime

S. M. Falcao sfalcao at ig.com.br
Thu Sep 16 22:47:49 CEST 2010


  Hello,

I'am starting with Lazarus and after one week project I decided to try a 
bit challenging one, so I've decided to create a chess GUI.  I've 
created a not so smart group of TImages at design time and loaded images 
corresponding white and black squares what worked accordingly, ofc, 
after my short test, I've decided try to create them at runtime with the 
following code:

var
   Form1: TForm1;
   Square_a : array [1..8] of TImage;

.
.

procedure TForm1.FormCreate(Sender: TObject);
begin
   Square_a[1] := TImage.Create (Self);
   Square_a[1].Enabled:=True;
   Square_a[1].Visible:=True;
   Square_a[1].AutoSize:=False;
   Square_a[1].Left:=0;
   Square_a[1].Top:=300;
   Square_a[1].Height:=50;
   Square_a[1].Width:=50;
   Square_a[1].Name:='a1';
   Square_a[1].Picture.LoadFromFile('white.jpg');
end;

For my surprise I could not manage to make white.jpg visible. Maybe is 
an obviuos mistake from my side, I am checking some docs about TImage 
usage,  if someone already knows what is wrong with this code would save 
me some time.

Thanks a lot






More information about the Lazarus mailing list