System.IO.StreamReader sr = new System.IO.StreamReader(webBrowser1.DocumentStream, Encoding.GetEncoding("gb2312"));
string html = sr.ReadToEnd();//获取源文件
sr.Close();
/*截取table 的html源文件*/
int start = html.IndexOf("<table id=\"post_tb\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\">");
int end = html.IndexOf("</table>", start) + 8;
string tbhtm = html.Substring(start, end - start);
webBrowser1.DocumentText = tbhtm;//设置为table的html代码
C#利用webBrowser怎么显示网页中只想显示的部分
最新推荐文章于 2023-10-31 10:39:54 发布