[Lazarus] TImage at runtime
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Sep 16 22:53:41 CEST 2010
On Thu, 16 Sep 2010 17:47:49 -0300
"S. M. Falcao" <sfalcao at ig.com.br> wrote:
> 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');
Square_a[1].Parent:=Self;
> 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.
Mattias
More information about the Lazarus
mailing list