【发布时间】:2020-02-10 15:50:52
【问题描述】:
使用 Delphi Rio 10.3.3,我编写了一个在 WebBrowser 组件中显示网页的程序。 不幸的是,即使该组件将 html 代码字符串作为其参数,它也会显示一个空白页面。奇怪的是,页面只有在 loadformstrings 方法后放置 ShowMessage 后才会显示。我知道 WebBorwser 不是 FMX 绘制的,但没有解决方案?
sStr :=
<html>
<body>
This is a Test !!!
</body>
</html>
WebBrowser1.Navigate('about:blank');
WebBrowser1.LoadFromStrings(sStr, '');
// ShowMessage('Test'); // If not commented out, the webbrowser shows the content
【问题讨论】:
-
主 UI 循环需要运行。在 Windows 下,
Application.ProcessMessages();将执行此操作。最好在线程中完成工作并让 UI 保持响应,而无需调用 ProcessMessages。 -
谢谢!我解决了!!!
标签: delphi