1 对有ID的文本框赋值
webBrowser1.Document.GetElementById("emailValue").InnerText = "ganhui21312312@sina.com";
2 设置单选(推荐使用点击事件而不是直接修改属性)
webBrowser1.Document.GetElementById("controlID").InvokeMember("click");
3 将图片加载到picbox
HTMLDocument html
=
(HTMLDocument)
this
.webBrowser1.Document.DomDocument;
IHTMLControlElement img = (IHTMLControlElement)webBrowser1.Document.Images[ " regValImg " ].DomElement;
IHTMLControlRange range = (IHTMLControlRange)((HTMLBody)html.body).createControlRange();
range.add(img);
range.execCommand( " Copy " , false , null );
img = null ;
range = null ;
html = null ;
if (Clipboard.ContainsImage())
{
this .pictureBox1.Image = null ;
this .pictureBox1.Image = Clipboard.GetImage();
}
Clipboard.Clear();
IHTMLControlElement img = (IHTMLControlElement)webBrowser1.Document.Images[ " regValImg " ].DomElement;
IHTMLControlRange range = (IHTMLControlRange)((HTMLBody)html.body).createControlRange();
range.add(img);
range.execCommand( " Copy " , false , null );
img = null ;
range = null ;
html = null ;
if (Clipboard.ContainsImage())
{
this .pictureBox1.Image = null ;
this .pictureBox1.Image = Clipboard.GetImage();
}
Clipboard.Clear();
4 提交表单
HtmlElement form = webBrowser1.Document.GetElementById("submit");
form.InvokeMember("click");