0
我得到一个错误说试图注入CSS代码
每个语句不能对“mshtml.IHTMLElement”类型的变量操作,因为“mshtml.Element”不包含GetEnumerator'`的”一个公共定义
Var document = BookDocBrowser.Document as mshtml.Document
//BookDocBrowser is a WebBrowser control
Var collection = document.getElementById("text");
Foreach (IHTMLElement input collection)
//collection is underlined in red here when I start the //foreach loop
{
dynamic currentStyle = (input as IHTMLElement2);
input.style.setAttribute(" wordwrap","break-word");
}
我试图做的是注入的CSS代码到已装上WebBrowser控件
请复制+粘贴代码,而不是手写的。否则,你一定会犯一个可能误导人的错误。例如,大部分代码都不会编译。 “Foreach”应该是“每个”,等等。在任何情况下,我会假设'getElementById'返回一个单独的项目,所以你不能循环它。 – Rob
对不起,我没有与我的电脑互联网连接。 – Titan
这是最后一次编辑 – Titan