property mylabelcaption:String read Flabelcaption write Setlabelcaption;中的setlabelcaption是否只能有一个参数,格式必须为procedure SetLabelCaption(Value: String);?
如果我编写的控件里面有很多的label,而且procedure SetLabelCaption(Value: String);的代码完全一样,能否实现代码重用?
procedure SetLabelCaption(Value: String);能否多传一个sender进去呢?

解决方案 »

  1.   


       有两种方法:
        第一种:     funciton getcaptions(index:intger):string;
         procedure setcaptions(index:integer;value:string);   
         ....
         ....
         property Captions[index:integer]:string read getcaptions write setcaptions;  第二种是:
        property Caption1: string index 0 read getvalue write SetValue;
        property Caption2: string index 1 read getvalue write SetValue;
        property Caption3: string index 2 read getvalue write SetValue;
        property Caption4: string index 3 read getvalue write SetValue;
        property Caption5: string index 4 read getvalue write SetValue;