Dar*_*tar 8 browser delphi jquery jquery-ui
我正在处理一个应用程序,许多UI元素将在TWebBrowser中.所以我想我添加了一个jQuery UI,让我很容易.
由于http://www.jasontpenny.com/blog/2008/11/21/jquery-in-a-twebbrowser-in-a-self-contained-delphi-app/,我能够插入JQuery和UI javascript文件
我被困在样式表中,我做到了
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.
Run Code Online (Sandbox Code Playgroud)
Javascripts跑得很好,但我无法让图像工作.我也试过StringReplace所有图片引用,但没有结果.
stylesheet.cssText := StringReplace(stylesheet.cssText,
'url(images/','url(' + FileProtocol(AppPath('templates/css/' +
JQueryUITheme + '/images/')), [rfReplaceAll]);
Run Code Online (Sandbox Code Playgroud)
有人试过类似的东西?
运行快速测试,这似乎工作.
你确定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;
Run Code Online (Sandbox Code Playgroud)
[更新]
我从主页下载链接[ 当前(稳定) ] 下载了JQuery UI ,并从中获取了动画图像http://jqueryui.com/demos/progressbar/#animated
在GitHub上查看演示项目: http://github.com/jasonpenny/democode/tree/057f0ad22fc5c3272909de346b6e67b0444d8981/JQueryUIProgBar
归档时间: |
|
查看次数: |
3906 次 |
最近记录: |