用乙個屬性儲存乙個動態陣列

2021-04-12 22:06:25 字數 978 閱讀 5653

用乙個屬性儲存乙個動態陣列,可是弄了半天就是存不下來,

象imagelist,*******等可以動態新增的控制項是如何實現儲存的,

用動態陣列能實現嗎?請高手指點

如果不需要在設計時賦值,可以用tlist, tstringlist, tobjectlist儲存,然後宣告屬性及訪問方法,以字串為例:

private

flist: tstringlist;

function getitem(index: integer): string;

procedure setitem(index: integer; const value: string);

function getcount: integer;

public

property count: integer read getcount; // 數目

property items[index: integer]: string read getitem write setitem;

function tform1.getcount: integer;

begin

result := flist.count;

end;

function tform1.getitem(index: integer): string;

begin

result := flist[index];

end;

procedure tform1.setitem(index: integer; const value: string);

begin

assert( index<=flist.count ); // 最多為比數目大乙個

if index=flist.count then

flist.add( value ) // 如果比數目多乙個,就增加

else

flist[index] := value;

end;

SQL用乙個儲存過程呼叫另乙個儲存過程

一 直接呼叫的例子 建被呼叫儲存過程b create procedure b sql nvarchar 500 null,outpara nvarchar 500 output asdeclare sqlstr nvarchar 500 begin set outpara sql end 建呼叫儲存...

乙個儲存過程

create or replace package abc zys is procedure daily census end abc zys 建乙個包,包中有儲存過程daily census。不涉及任何引數。create or replace package body abc zys is pro...

乙個儲存過程

首先是建立儲存過程.drop procedure if exists externalcalltocomplete delimiter create procedure externalcalltocomplete begin drop table if exists temp1 create ta...