2

I know that when I add a collection item to a collection, the index is zero-based. I would like to make it one-based and show the value in a property called Id. Can someone tell me how I can go about this in code?

TCVSClassItem = class(TCollectionItem)  
private  
 fId: Integer;  
 function GetId: Integer;  
public  
published  
 property Id: Integer read GetId;  
end;  

function TCVSClassItem.GetId: Integer;  
begin  
 result:=  ????  
end;
4

1 回答 1

4

结果 := Index+1 如果我正确理解您的需求,应该这样做

于 2010-12-29T00:10:35.980 回答