例一:
动态数组
var fields: array of integer;
Setlenght(fields)//定义长度
例二:
var
button:array of TButton;
i,rows:integer;
begin
rows:=10;
SetLength(button,rows);
for i:=0 to Rows-1 do
begin
button[i]:=TButton.Create(self);
with button[i] do
begin
Parent:=form1; //此行必不可少,否则控件在屏幕显示不出
top:=i*40;
width:=60;
height:=20;
left:=50;
end;
end;
TStringList
动态数组创建与使用
本文介绍了如何使用 Delphi 创建动态数组并实例化控件数组。通过示例代码展示了如何设置数组长度、创建 TButton 实例并正确设置其属性以便在界面上显示。
4880

被折叠的 条评论
为什么被折叠?



