Delphi can also implement control arrays by defining array variables to implement control arrays.
My expression ability is limited, and this article is my first time publishing a document, so please forgive me for any inconveniences.
When we use Delphi, we sometimes find a problem, that is, Delphi does not allow us to easily define control arrays like software such as VB or VF. When I write a multimedia demo CD, I need to use a lot of Image controls, and if I don't use a control array, it will be very troublesome and complicated to write the program. So after thinking for a long time, I finally decided to implement the control array by defining array variables.
Here is the code:
PRocedure Tfrm_main.FormCreate(Sender: TObject);
var
image:array[1..12] of TImage; //Used to store 12 image frames
label:array[1..12] of TLabel;//used to store 12 label labels
begin
//Pay the image object to the image array
image[1]:=image1;
image[2]:=image2;
image[3]:=image3;
image[4]:=image4;
image[5]:=image5;
image[6]:=image6;
image[7]:=image7;
image[8]:=image8;
image[9]:=image9;
image[10]:=image10;
image[11]:=image11;
image[12]:=image12;
//Pay the label object to the label array
label[1]:=label1;
label[2]:=label2;
label[3]:=label3;
label[4]:=label4;
label[5]:=label5;
label[6]:=label6;
label[7]:=label7;
label[8]:=label8;
label[9]:=label9;
label[10]:=label10;
label[11]:=label11;
label[12]:=label12;
end;