我在 Delphi 7 中创建了一个已发布的 TBitmap 属性。我可以在设计时由编辑器设置它的值,如果我记得编辑器,我可以看到正确的图片。但是当我保存、关闭并重新打开表单时,TBitmap 属性为空。什么不见了?我知道有加载的虚拟方法。但是我应该在里面做什么?
TCustomComponent = class ( TComponent )
private
fBitmap : TBitmap;
protected
procedure loaded; override;
procedure setBitmap( bitmap_ : TBitmap );
public
constructor create( owner_ : TComponent ); override;
destructor destroy; override;
published
property bitmap : TBitmap read fBitmap write setBitmap;
end;
procedure TCustomComponent.loaded;
begin
inherited loaded;
// ???
end;
procedure TCustomComponent.setBitmap( bitmap_ : TBitmap );
begin
fBitmap.assign( bitmap_ );
end;
constructor TCustomComponent.create( owner_ : TComponent );
begin
inherited create( owner_ );
fBitmap := TBitmap.create;
end;
destructor TCustomComponent.destroy;
begin
fBitmap.free;
inherited destroy;
end;