https://www.cnblogs.com/onechen/p/6219144.html
提问:如下安装后的 TMyPanel 能在设计期时正常显示,但 TMyPanel2 在设计期时是白板,不能正常看到,为什么?
TMyPanel = class(TPanel) end; TMyCustomPanel = class(TPanel) TMyPanel2 = class(TMyCustomPanel) end; RegisterComponent('Test', [TMyPanel, TMyPanel2]);
可能:是隔代无法继承 Style 造成的,改成如下就可以了:
TMyPanel = class(TPanel) end; TMyCustomPanel = class(TPanel) end; TMyPanel2 = class(TMyCustomPanel) protected function GetDefaultStyleLookupName: string; override; end; function TMyPanel2.GetDefaultStyleLookupName: string; begin Result := 'panelstyle'; end;