gpt4 book ai didi

jquery - Delphi 中的 TWebBrowser 具有 jQuery UI 框架

转载 作者:行者123 更新时间:2023-12-03 14:48:16 24 4
gpt4 key购买 nike

我正在开发一个应用程序,许多 UI 元素将位于 TWebBrowser 中。所以我想添加一个 jQuery UI 以方便我使用。

我能够插入 JQuery 和 UI javascript 文件,这要归功于 http://www.jasontpenny.com/blog/2008/11/21/jquery-in-a-twebbrowser-in-a-self-contained-delphi-app/

我被样式表困住了,我做到了

  doc2 := Web.Document as IHTMLDocument2;
doc2.createStyleSheet(FileProtocol(AppPath( 'templates\css\' + JQueryUITheme + '\jquery-ui-1.7.1.custom.css')), 0);
// FileProtocol and AppPath are to return a current application path and converted to FileProtocol URL format.

Javascript 运行良好,但我无法使图像正常工作。我也尝试过 StringReplace 所有图像引用,但没有结果。

 stylesheet.cssText := StringReplace(stylesheet.cssText,
'url(images/','url(' + FileProtocol(AppPath('templates/css/' +
JQueryUITheme + '/images/')), [rfReplaceAll]);

有人尝试过类似的方法吗?

最佳答案

运行快速测试,这似乎有效。

您确定 FileProtocol() 和 AppPath() 正常工作吗?

这些似乎对我有用:

function FileProtocol(const s: String): String;
begin
Result := 'file:///' + StringReplace(s, '\', '/', [rfReplaceAll]); // '
end;

function AppPath(const s: String): String;
begin
Result := IncludeTrailingPathDelimiter( ExtractFilePath(Forms.Application.ExeName) ) + s;
end;

[更新]

我从主页下载链接下载了 JQuery UI [ Current (stable) ],并从 获取动画图像http://jqueryui.com/demos/progressbar/#animated

查看 GitHub 上的演示项目: http://github.com/jasonpenny/democode/tree/057f0ad22fc5c3272909de346b6e67b0444d8981/JQueryUIProgBar

关于jquery - Delphi 中的 TWebBrowser 具有 jQuery UI 框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/851475/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com