我想让WebBrowser 显示一个网页的某一部分 可以是通过滚动条 或者是提取HTML代码解析的 方式 
有办法实现么 
谢谢

解决方案 »

  1.   

    WebBrowser m_web = new WebBrowser();
    m_web.Navigate("http:// or someware you wnat to go");
    //Now you can parse your html document text, and abstrace what you want.
    m_web.DocumentText
      

  2.   

    m_web.DocumentText 好像返回的是 url啊
      

  3.   

    你为什么不实一下呢?以下是得到google首页的能容。需要注意的是 必需的保证Navigate load完所要的网页。public Form1()
    {
    InitializeComponent();
    webBrowser1.Navigate("http://www.google.com");
    }private void button1_Click(object sender, EventArgs e)
    {
    string content = webBrowser1.DocumentText;
    }我用debuger得到的content的值。
    content "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"><title>Google</title><style>body,td,a,p,.h{font-family:arial,sans-serif}.h{font-size:20px}.h{color:#3366cc}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}#gbar{height:22px;padding-left:2px}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbi,#gbs{background:#fff;left:0;position:absolute;top:24px;visibility:hidden;z-index:1000}#gbi{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}#guser{padding-bottom:7px !important}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1,.gb3{height:22px;margin-right:.73em;vertical-align:top}#gbar{float:left}}.gb2{display:block;padding:.2em .5em}a.gb1,a.gb2,a.gb3{color:#00c !important}.gb2,.gb3{text-decoration:none}a.gb2:hover{background:#36c;color:#fff !important}</style><script>window.google={kEI:\"9-DkSMrzDomoQtD3we8M\",kEXPI:\"17259,17311,17406,17735\",kHL:\"en\"};\nfunction sf(){document.f.q.focus()}\nwindow.clk=function(b,c,d,e,f,g){if(document.images){var a=encodeURIComponent||escape;(new Image).src=\"/url?sa=T\"+(c?\"&oi=\"+a(c):\"\")+(d?\"&cad=\"+a(d):\"\")+\"&ct=\"+a(e)+\"&cd=\"+a(f)+(b?\"&url=\"+a(b.replace(/#.*/,\"\")).replace(/\\+/g,\"%2B\"):\"\")+\"&ei=9-DkSMrzDomoQtD3we8M\"+g}return true};\nwindow.gbar={};(function(){var b=window.gbar,f,h;b.qs=function(a){var c=window.encodeURIComponent&&(document.forms[0].q||\"\").value;if(c)a.href=a.href.replace(/([?&])q=[^&]*|$/,function(i,g){return(g||\"&\")+\"q=\"+encodeURIComponent(c)})};function j(a,c){a.visibility=h?\"hidden\":\"visible\";a.left=c+\"px\"}b.tg=function(a){a=a||window.event;var c=0,i,g=window.navExtra,d=document.getElementById(\"gbi\"),e=a.target||a.srcElement;a.cancelBubble=true;if(!f){f=document.createElement(Array.every||window.createPopup?\"iframe\":\"div\");f.frameBorder=\"0\";f.src=\"#\";d.parentNode.appendChild(f).id=\"gbs\";if(g)for(i in g)d.insertBefore(g[i],d.firstChild).className=\"gb2\";document.onclick=b.close}if(e.className!=\"gb3\")e=e.parentNode;do c+=e.offsetLeft;while(e=e.offsetParent);j(d.style,c);f.style.width=d.offsetWidth+\"px\";f.style.height=d.offsetHeight+\"px\";j(f.style,c);h=!h};b.close=function(a){h&&b.tg(a)}})();</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload=\"sf();if(document.images){new Image().src='/images/nav_logo3.png'}\" topmargin=3 marginheight=3><div id=gbar><nobr><b class=gb1>Web</b> <a href=\"http://images.google.com/imghp?hl=en&tab=wi\" onclick=gbar.qs(this) class=gb1>Images</a> <a href=\"http://maps.google.com/maps?hl=en&tab=wl\" onclick=gbar.qs(this) class=gb1>Maps</a> <a href=\"http://news.google.com/nwshp?hl=en&tab=wn\" onclick=gbar.qs(this) class=gb1>News</a> <a href=\"http://www.google.com/prdhp?hl=en&tab=wf\" onclick=gbar.qs(this) class=gb1>Shopping</a> <a href=\"http://mail.google.com/mail/?hl=en&tab=wm\" class=gb1>Gmail</a> <a href=\"http://www.google.com/intl/en/options/\" onclick=\"this.blur();gbar.tg(event);return !1\" class=gb3><u>more</u> <small>&#9660;</small></a><div id=gbi><a></a> <a href=\"http://video.google.com/?hl=en&tab=wv\" onclick=gbar.qs(this) class=gb2>Video</a> <a href=\"http://groups.google.com/grphp?hl=en&tab=wg\" onclick=gbar.qs(this) class=gb2>Groups</a> <a href=\"http://books.google.com/bkshp?hl=en&tab=wp\" onclick=gbar.qs(this) class=gb2>Books</a> <a href=\"http://scholar.google.com/schhp?hl=en&tab=ws\" onclick=gbar.qs(this) class=gb2>Scholar</a> <a href=\"http://finance.google.com/finance?hl=en&tab=we\" onclick=gbar.qs(this) class=gb2>Finance</a> <a href=\"http://blogsearch.google.com/?hl=en&tab=wb\" onclick=gbar.qs(this) class=gb2>Blogs</a> <div class=gb2><div class=gbd></div></div><a></a> <a href=\"http://www.youtube.com/?hl=en&tab=w1\" onclick=gbar.qs(this) class=gb2>YouTube</a> <a href=\"http://www.google.com/calendar/render?hl=en&tab=wc\" class=gb2>Calendar</a> <a href=\"http://picasaweb.google.com/home?hl=en&tab=wq\" onclick=gbar.qs(this) class=gb2>Photos</a> <a href=\"http://docs.google.com/?hl=en&tab=wo\" class=gb2>Documents</a> <a href=\"http://www.google.com/reader/view/?hl=en&tab=wy\" class=gb2>Reader</a> <a href=\"http://sites.google.com/?hl=en&tab=w3\" class=gb2>Sites</a> <div class=gb2><div class=gbd></div></div><a></a> <a href=\"http://www.google.com/intl/en/options/\" class=gb2>even more &raquo;</a> </div></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><div align=right id=guser style=\"font-size:84%;padding:0 0 4px\" width=100%><nobr><a href=\"/url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNFA18XPfgb7dKnXfKz7x7g1GDH1tg\">iGoogle</a> | <a href=\"https://www.google.com/accounts/Login?continue=http://www.google.com/&hl=en\">Sign in</a></nobr></div><center><br clear=all id=lgpd><img alt=\"Google\" height=110 src=\"/intl/en_ALL/images/logo.gif\" width=276><br><br><form action=\"/search\" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><input autocomplete=\"off\" maxlength=2048 name=q size=55 title=\"Google Search\" value=\"\"><br><input name=btnG type=submit value=\"Google Search\"><input name=btnI type=submit value=\"I'm Feeling Lucky\"></td><td nowrap width=25%><font size=-2>&nbsp;&nbsp;<a href=/advanced_search?hl=en>Advanced Search</a><br>&nbsp;&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&nbsp;<a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><br><font size=-1>Sign up to vote in your state. <a href=\"/aclk?sa=L&ai=BZIMCLd_kSJrvIo3kQteqjboPkd7FdrHY27cJwdmc2RPQhgMQARgBIMFUOABQkYXFhPn_____AWCfAw&num=1&sig=AGiWqtzvHmfuEKHnwGXdWxy7mr8fmCfSvQ&q=http://maps.google.com/maps/mpl%3Fmoduleurl%3Dhttp://maps.google.com/mapfiles/mapplets/elections/2008/us-voter-info/us-voter-info.xml#utm_source=google&utm_medium=link&utm_campaign=hpp&utm_term=voterinfohpp\">Get registered today!</a></font><br><br><br><font size=-1><a href=\"/intl/en/ads/\">Advertising&nbsp;Programs</a> - <a href=\"/services/\">Business Solutions</a> - <a href=\"/intl/en/about.html\">About Google</a> - <b><a href=http://www.google.dk/>Go to Google Dan</a></b></font><p><font size=-2>&copy;2008 - <a href=\"/intl/en/privacy.html\">Privacy</a></font></p></center></body><script>google.y={first:[]};window.setTimeout(function(){var xjs=document.createElement('script');xjs.src='/extern_js/f/CgJlbiswCjgHLCswGDgCLA/FQ1b7bFTJak.js';document.getElementsByTagName('head')[0].appendChild(xjs)},0)</script><script>google.y.first.push(function(){google.ac.i(document.f,document.f.q,'','')})</script><script>google.xjs_ready=1</script></html>" string