请教Tcollection对象的Add方法的使用方法 我新建了一个Tcollection对象,如何使用Add方法增加一个TcollectionItem..请给一个有关Tcollection对象的例子说明. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 TCollectionItem.Create(FCollection); 帮助上说最好用Collection的Add方法增加Collectionitem,但我不会用,能详细介绍一下Tcollection对象的使用方法吗,最好给个例子说明...谢谢!! 其实差不多的。。var Item:TCollectionItem;begin item:=FCollection.Add;//只是省掉了TCollectionItem.Create。。 item.DisplayName:='hello';创建后使用这个ITEM。 完整一些的,自己定义一个类,继承自TCollectionItem TMyItem =class(TCollectionItem) public xxx:string; end;var aCollection:TCollection; item:TCollectionItem;begin aCollection:=TCollection.Create(TMyItem); item:=aCollection.Add; (item as TMyItem).xxx:='Hello';。。end; 请图片识别DEMO,大牛来出出招吧! 画线 置顶 一秒关机,有须要的朋友进来看看,希望高手能把此代码译成Delphi,100分感谢! 毕业设计做完了,感谢这个论坛 SOS!!!谁可以提供与Delphi有关的英文文章? 怎樣實現在DBGrid每條記錄可中加入TButton 控件? 空前绝后巨简单问题,纯属送分. 哪里有CodeRush 6 下载 Delphi中如何简便地将当前的记录复制,再将复制的记录插入原来的Table中? 在预览的时候,TQRExpr报告错误:Too many arguments 为何无法为Combobox1 指定初始值? 原子函数的使用
TCollectionItem.Create(FCollection);
Item:TCollectionItem;begin
item:=FCollection.Add;//只是省掉了TCollectionItem.Create。。
item.DisplayName:='hello';创建后使用这个ITEM。
public
xxx:string; end;var
aCollection:TCollection;
item:TCollectionItem;
begin
aCollection:=TCollection.Create(TMyItem);
item:=aCollection.Add;
(item as TMyItem).xxx:='Hello';
。。end;