gpt4 book ai didi

CSS 和 TWebbrowser delphi

转载 作者:行者123 更新时间:2023-11-28 10:23:13 25 4
gpt4 key购买 nike

我想知道是否可以操纵网站的 CSS。例如输入字段中的颜色?我看了几个问题,但我不清楚是否可能。

For Example in Google Chrome, Whenever a field is selected it shows a golden line around the outsite.是否可以在任何网站上使用 delphi 执行此操作和其他操作。编写应用于在 Twebbrowser 中打开的网站的 CSS 代码?仅供个人观看

谢谢

我也可以使用此代码更改输入字段背景的颜色吗?我可以更改背景颜色和更改字体大小,但似乎无法弄清楚输入字段的颜色或边框。这是代码:

http://www.delphidabbler.com/tips/58

最佳答案

加载页面后,可以通过从代码添加样式表来修改 CSS:

var
document: IHTMLDocument2;
stylesheet: IHTMLStyleSheet;
stylesheetIndex: Integer;
begin

// Inject CSS Style Sheets
document := webBrowser1.Document as IHTMLDocument2;

stylesheetIndex := document.styleSheets.length;
if stylesheetIndex > 31 then
raise Exception.Create('Already have the maximum amount of CSS stylesheets');

stylesheet := document.createStyleSheet('', stylesheetIndex);
stylesheet.cssText := ...

关于CSS 和 TWebbrowser delphi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5107369/

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