例如我的控件声明如下:TMyPanel = class(TPanel)
private
FMyArray: array [1..800] of TMyArray;//多少还不固定,800是上限
published
property ArrayCount: Integer read FArrayCount write SetArrayCount
end;我为了节省内存占用,可以在属性页上输入ArrayCount的值,比如15,但为什么跟踪下面函数时,ArrayCount的当前值却不是15呢?我应该怎么作?constructor TMyPanel.Create(AOwner: TComponent);
var
i: Integer;
begin
for i:= 1 to ArrayCount do
begin
FMyArray[i]:= TMyArray.Create;
end;
end;多谢各位帮忙了!
private
FMyArray: array [1..800] of TMyArray;//多少还不固定,800是上限
published
property ArrayCount: Integer read FArrayCount write SetArrayCount
end;我为了节省内存占用,可以在属性页上输入ArrayCount的值,比如15,但为什么跟踪下面函数时,ArrayCount的当前值却不是15呢?我应该怎么作?constructor TMyPanel.Create(AOwner: TComponent);
var
i: Integer;
begin
for i:= 1 to ArrayCount do
begin
FMyArray[i]:= TMyArray.Create;
end;
end;多谢各位帮忙了!
解决方案 »
- 怎么设置另一个form上TabOrder为0的edit为焦点位置。
- 求 Raize4.3.2 控件包自带说明文档
- 如何将一个程序的各个模块拆分成DLL又能保持逻辑上的可访问性
- 关于一个简单的问题,完全是送分的!
- 如何拖动整个窗体?
- 请问高手如何获取ISAPI的dll程序所在的绝对路径?用于设置ADOquery组件中connectstring属性的数据库绝对路径!
- 送分问题
- Ehlib 的 DBGridEh 控件怎样才能像 dxDBGrid 控件那样输出文件到 EXCEL ?
- 在mdi表單中調用設為最大化的子表單時,它首先顯示小的子表單,然后才把它最大化,影響美觀,有何辦法解決?
- 关于QuickReport的一个导致死机的问题。报表我不陌生,但是...
- DELPHI中如何实现类似C中的宏或者模板功能,欢迎讨论,分不够再加
- 简单的插入时间SQL语句
constructor TMyPanel.Create(AOwner: TComponent;aArrayCount:Integer );
constructor TMyPanel.Create(AOwner: TComponent;aArrayCount:Integer);
var
i: Integer;
begin
ArrayCount:=aArrayCount;
for i:= 1 to aArrayCount do
begin
FMyArray[i]:= TMyArray.Create;
end;
end;
很简单的定义,FArrayCount:integer;To hongqi162:
我把构造函数改成你的形式,但连窗体都放不上去啊?难道只能程序里运行时创建吗?
private
FMyArray: array [1..800] of TMyArray;//多少还不固定,800是上限
published
property ArrayCount: Integer read FArrayCount write SetArrayCount default 15;//设定默认值为15
end;constructor TMyPanel.Create(AOwner: TComponent);
var
i: Integer;
begin
for i:= 1 to ArrayCount do
begin
FMyArray[i]:= TMyArray.Create;
end;
end;
看来不能放在TMyPanel.Create里实现了。另外也感谢chenzhuo兄,fenger8293兄,多谢