1:TList是直接从TObject继承二来的一个类,不是可视控件,一般可以把它作为一个对象的容器来用。
2:TList, which stores an array of pointers, is often used to maintain lists of objects.
3:能不能说详细点,最好举个例子!
4:自己看看TList的属性和方法,无非也就是Add,IndexOf等。。。
5:procedure TForm1.Button1Click(Sender: TObject);
var
MyList: TList;
I: Integer;
begin
MyList := TList.Create; {Create a list }
MyList.Add(PChar('A string')); {Add a string}
MyList.Add(PChar('')); { Add an empty string }
MyList.Add(nil); {Add nil }
MyList.Add(PChar('')); { Add another empty string }
Edit1.Text := IntToStr(MyList.Count); {Put count into Edit1}
Mylist.Pack; {Pack the list.}
Edit2.Text := IntToStr(MyList.Count); {Put count into Edit2}
MyList.Free; {Free memory for list}
end;
2:TList, which stores an array of pointers, is often used to maintain lists of objects.
3:能不能说详细点,最好举个例子!
4:自己看看TList的属性和方法,无非也就是Add,IndexOf等。。。
5:procedure TForm1.Button1Click(Sender: TObject);
var
MyList: TList;
I: Integer;
begin
MyList := TList.Create; {Create a list }
MyList.Add(PChar('A string')); {Add a string}
MyList.Add(PChar('')); { Add an empty string }
MyList.Add(nil); {Add nil }
MyList.Add(PChar('')); { Add another empty string }
Edit1.Text := IntToStr(MyList.Count); {Put count into Edit1}
Mylist.Pack; {Pack the list.}
Edit2.Text := IntToStr(MyList.Count); {Put count into Edit2}
MyList.Free; {Free memory for list}
end;
本文介绍了TList类的基本概念及其在Delphi中的应用。TList作为TObject的子类,主要用于存储对象指针数组,便于管理和操作一系列对象。通过示例代码展示了如何创建TList实例、添加元素、获取元素数量及释放资源。
1701

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



