• 7417阅读
  • 0回复

【原创】在C#中使用WebBrowser控件 [复制链接]

上一主题 下一主题
离线XChinux
 

只看楼主 倒序阅读 楼主  发表于: 2005-07-30
在C#中使用WebBrowser控件,需要先把WebBrowser控件和MSHTML组件添加进来.
使用的代码如下:
mshtml.IHTMLDocument2 document = (mshtml.IHTMLDocument2)axWebBrowser1.Document;
         
          mshtml.IHTMLInputTextElement text1= (mshtml.IHTMLInputTextElement)document.all.item("text1", null);
          text1.value = "你的名字"
          mshtml.IHTMLSelectElement select1= (mshtml.IHTMLSelectElement)document.all.item("select1", null);
          select1.selectedIndex = 1;
          mshtml.IHTMLTextAreaElement content = (mshtml.IHTMLTextAreaElement)document.all.item("content", null);
          content.value = "这是休息";
          //mshtml.IHTMLFormElement Form1 = (mshtml.IHTMLFormElement)document.all.item("Form1", null);
          //Form1.submit();
          mshtml.HTMLButtonElement Button1 = (mshtml.HTMLButtonElement)document.all.item("Button1", null);
          Button1.onclick = "true";
          Button1.click();


发表时间: 2005-05-23 15:34
[ 此贴被XChinux在2005-08-13 09:09重新编辑 ]
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
快速回复
限100 字节
 
上一个 下一个