WebBrowser的简单使用
加载初始网页
this.webBrowser1.Url = new Uri("http://www.google.com");
加载初始html
webBrowser1.DocumentText =
"<html><body>Please enter your name:<br/>" +
"<input type='text' name='userName'/><br/>" +
"<a href='http://www.microsoft.com'>continue</a>" +
"<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>" +
"<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>" +
"<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>"+
"</body></html>";
或
webBrowser1.Navigate(@"D:\A\test.html");
加载pdf文件
this.webBrowser1.Url = new Uri(@"D:\pdf\a.pdf");
在html中嵌入pdf
webBrowser1.DocumentText = "<html><body><p><center><h1> PDF in HTML </h1></center></p>" +
"<object classid = 'clsid:CA8A9780-280D-11CF-A24D-444553540000' width = '100%' height = '720'>" +
@"<param name = 'SRC' value = 'D:\pdf\a.pdf'>" +
@"<embed width = '100%' height = '400' fullscreen = 'yes' src = 'D:\pdf\a.pdf'>" +
"<noembed></noembed></embed></object></body></html>";
把圈子变小,把语言变干净,把成绩往上提,把故事往心里收,现在想要的以后你都会有。