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