Delphi can also implement an array of controls, and use the array variable to implement an array of controls.

zhaozj2021-02-16  55

Delphi can also implement an array of controls, and use the array variable to implement an array of controls.

The younger brother's expression ability is limited. This article is the first time I published a document, so I would like to include more people.

When we use Delphi, we sometimes find a problem, which is Delphi that can define an array of controls like a software such as VB or VF. The younger brother uses a lot of image controls when writing a multimedia's demo CD, and if there is no array of controls, the program will make the program make troubles and complicated. So I thought for a long time, I finally decided to implement an array of controls with the definition array variables.

Below is the code:

Procedure TFRM_MAIN.FORMCREATE (Sender: TOBJECT); var image: array [1..12] of timage; // Used to store 12 image image box Label: array [1..12] of tlabel; // for storing 12 Label tabs begin // paid Image object to 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; // Put 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;

To this, you can use the control like a control array.

转载请注明原文地址:https://www.9cbs.com/read-25052.html

New Post(0)