使用代码创建TChromium实例
我在尝试使用代码创建 Delphi Chromium Embedded 实例时遇到问题
var
Chromium: TChromium;
begin
Chromium := TChromium.Create(TcxTabSheet1);
Chromium.Parent := TWinControl(TcxTabSheet1);
Chromium.Align := alClient;
Assert(Assigned(Chromium.Browser), 'HERE! Why Browser is not assigned.');
...
end;
似乎浏览器属性在
procedure TCustomChromium.CreateWindowHandle(const Params: TCreateParams);
调用时已初始化。
为什么我的代码中没有调用 CreateWindowHandle?
I have an issue trying to create Delphi Chromium Embedded instance with code
var
Chromium: TChromium;
begin
Chromium := TChromium.Create(TcxTabSheet1);
Chromium.Parent := TWinControl(TcxTabSheet1);
Chromium.Align := alClient;
Assert(Assigned(Chromium.Browser), 'HERE! Why Browser is not assigned.');
...
end;
Seems like Browser property is initialized when
procedure TCustomChromium.CreateWindowHandle(const Params: TCreateParams);
is called.
Why CreateWindowHandle is not called in my code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的评论作为答案:
当从 CreateWindowHandle 初始化 Browser 属性时,尚未分配 Chromium.Browser 的原因是:
因为尚未执行任何调用 HandleNeeded 的操作(它将在以下情况下调用 CreateWindowHandle):尚未分配)
My comment as an answer:
The reason
Chromium.Browser
is not yet assigned, when the Browser property is initialized from the CreateWindowHandle, is:Because nothing has been done yet that calls HandleNeeded (which will call CreateWindowHandle when none has been assigned yet)