Имеется самописный (в процессе) класс:
TCardGridImage = class
FCardPanel: TCardPanel;
procedure SetCardPanel (Source: TCardPanel);
public
property CardPanel: TCardPanel write SetCardPanel; //FCardPanel;
end;
procedure TCardGridImage.SetCardPanel (Source: TCardPanel);
var
ms: TMemoryStream;
OldName: string;
as1, as2: Boolean;
begin
as1 := Assigned(Source);
as2 := Assigned(FCardPanel);
OldName := Source.Name;
Source.Name := ''; // needed to avoid Name collision
try
ms := TMemoryStream.Create;
try
ms.WriteComponent(Source);
ms.Position := 0;
ms.ReadComponent(FCardPanel);
finally
ms.Free;
end;
finally
Source.Name := OldName;
end;
end;
Пытаюсь присвоить в FCardPanel
CardPanel1
, но на строке ms.ReadComponent(FCardPanel);
выпадает ошибка:
raised exception class EClassNotFound with message 'Class TCardPanel not found'
Как обойти или исправить?
TCardPanel = class(TCustomCardPanel)
находится вVcl.WinXPanels
function Duplicate(): TCardPanel;
который будет сам создавать свою правильную копию?