Delphi组件有CreateWnd和CreateWindowHandle(DestroyWnd和DestroyWindowHandle).它们都打算被后代覆盖,对吧?除了底层的VCL实现之外,不打算调用它?
它们之间有什么区别; 什么时候应该被覆盖?
我正在尝试在Delphi中编写一个dll库,该函数创建一个TFrame后代的实例并返回它.但是当我在一个应用程序中导入这个函数时,每次调用它时我都会得到一个例外,例如"'xxx'控件没有父窗口".我不是百分百肯定,但是当访问任何GUI控件时,该类的构造函数中出现异常.
你能告诉我这种行为的原因是什么吗?我应该只使用TForm后代还是有更好的解决方案?
谢谢!
When we create a component as a custom control and the control is dropped on a panel the control always appears on the form rather than the containing control. How do you set the parent of the custom control in Create so that when the button is dropped on panel the buttons parent is the panel?
TGlassButton = class(TCustomControl)
...
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
...
constructor TGlassButton.Create(AOwner: TComponent);
begin
inherited; ???????????
inherited Create(AOwner); ????????????
Parent …Run Code Online (Sandbox Code Playgroud)