Delphi   发布时间:2022-04-10  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在Delphi中的TWebBrowser中使用jQuery UI框架大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在开发一个应用程序,许多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.

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

大佬总结

以上是大佬教程为你收集整理的在Delphi中的TWebBrowser中使用jQuery UI框架全部内容,希望文章能够帮你解决在Delphi中的TWebBrowser中使用jQuery UI框架所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。