C# webBrowser?????????
???????????? ???????[ 2013/12/18 10:08:49 ] ????????
????????HTML????????£?
<html>
<body>
<input type="button" id="btnClose" value="???" />
</body>
</html>
???????e?????????Event Handler????????£?
HtmlDocument htmlDoc = webBrowser.Document;
HtmlElement btnElement = htmlDoc.All["btnClose"];
if (btnElement != null)
{
btnElement.click += new HtmlElementEventHandler(HtmlBtnClose_Click);
}
|
????????HtmlBtnClose_Click?????Web??????Event Handler??
???????????????????????——???????????HTML???????к?????????????????HtmlElement?????????????á????????????????????????????????????????????????HtmlElement??AttachEventHandler???????
????btnElement.AttachEventHandler("onclick"?? new EventHandler(HtmlBtnClose_Click));
????//??????????????btnElement.click += new HtmlElementEventHandler(HtmlBtnClose_Click);
???????????????????"onclick"???????????????????????磺
????formElement.AttachEventHandler("onsubmit"?? new EventHandler(HtmlForm_Submit));
????Study Case 2???????form?????????д????
???????????WebBrowser????????????????????????????????????????????????????棬???????????????“???”?????????????????????????id????Name?????????username????????????id??password??“???”?????id??submitbutton???????????????webBrowser??DocumentCompleted???????????????????
HtmlElement btnSubmit = webBrowser.Document.All["submitbutton"];
HtmlElement tbUserid = webBrowser.Document.All["username"];
HtmlElement tbPasswd = webBrowser.Document.All["password"];
if (tbUserid == null || tbPasswd == null || btnSubmit == null)
return;
tbUserid.SetAttribute("value"?? "smalldust");
tbPasswd.SetAttribute("value"?? "12345678");
btnSubmit.InvokeMember("click");
|
??????????????SetAttribute????????????“value”???????InvokeMember????????????“click”??????????????Html????????е???????????????????????.Net 2.0????????HtmlElement??????????Html?????????????????????????????????е????????????Html????????????????????????MSDN??DHTML Reference??
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???????C#?е?StringC# Socket???????????????????C#?????????????????????????C#???????C#????????????Log4net??????δ????C#?????????????C#?????????????????C#???????????????C#????????????????C#7 ?е?Tuple??????C#??TypeScript - GeneratorC# ?????????細(xì)??????????C#?е???н???C#??MySQL?????????μ??Ч?????д??C#????C++??dll???C#??VS2010????е??????