加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

在Delphi中的TWebBrowser中使用jQuery UI框架

发布时间:2020-12-15 04:05:39 所属栏目:大数据 来源:网络整理
导读:我正在开发一个应用程序,许多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/ 我被困在
我正在开发一个应用程序,许多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( 'templatescss' + 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.

Javascripts跑得很好,但我无法让图像工作.我也试过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;

[更新]

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

请参阅GitHub上的演示项目:http://github.com/jasonpenny/democode/tree/057f0ad22fc5c3272909de346b6e67b0444d8981/JQueryUIProgBar

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读