0
我不確定我的編碼是否正確,所以如果我錯了請更正。 我有一個圖像的自定義組件。Delphi自定義組件析構函數
CustomPic = class(TPanel)
private
Image : TImage;
public
constructor Create(AOwner: TComponent); override;
....
end;
在我的構造我執行以下操作:
constructor CustomPic.Create(AOwner: TComponent);
begin
Image := TImage.Create(Self);
Image.Parent := Self;
AddObject(Image);
end
這一切工作正常。但是,當我將自定義組件放在表單上並將alt + F12和alt + F12重新打回到表單中時,我的表單上有一個額外的圖像。我應該在我的析構函數中實現一些東西嗎?
有一個遺漏的'繼承的創建(AOwner);'。請發佈reál代碼。 – NGLN 2013-05-02 19:59:12