Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating images dynamically - why isn't this code working?

Status
Not open for further replies.

Froskoy

Programmer
Jul 25, 2009
18
GB
Hi,

I'm playing around with creating images dynamically in Delphi 4. This code works when placed in the FormCreate procedure but not when placed in its own procedure. Why not?

The form is called frm1.

Code:
     for i:=1 to 10 do
     begin
          imgBT[i]:=TimgBT.Create(frm1);
          with imgBT[i] do
          begin
               Parent:=frm1;
               Width:=20;
               Height:=30;
               Picture.LoadFromFile(Path+IntToStr(i)+'.bmp');
               Transparent:=TRUE;
               Top:=100;
               Left:=40+20*i;
               Visible:=TRUE;
          end;
     end;

Creating the global variable/array BT:

Code:
type TimgBT = class(TImage);
var imgBT : array[1..10] of TimgBT;

Many thanks and merry Christmas,

Froskoy.
 
Sorry - I wasn't actually calling the procedure anywhere - the code does work! Silly me. Sorry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top