webbrowser1.Navigate(string urlString) ; 给该控件设置要显示的网址
    webbrowser1.GoBack(); 返回上个网页
    webbrowser1.GoForward(); 前进
    webbrowser1.Refresh(); 刷新
    webbrowser1.Stop(); 停止
    ————————————————
    使用StringBuilder写一个表格[

    ](https://www.bilibili.com/video/BV1FJ411W7e5?p=228&spm_id_from=pageDriver)

    属性:
    Url:指定Web浏览器控件导航到的URL。
    ScriptErrorsSuppressed:指定WebBrowser控件是否存在对话框显示脚本错误。

    image.png

    1. public partial class Form1 : Form
    2. {
    3. public Form1()
    4. {
    5. InitializeComponent();
    6. }
    7. private void btnEnter_Click(object sender, EventArgs e)
    8. {
    9. if (textBox1.Text=="")
    10. {
    11. webBrowser1.Navigate("http://www.baidu.com");
    12. }
    13. else
    14. {
    15. //利用构造函数将String传入uri实例中
    16. //webBrowser1.Url需要一个uri类型
    17. Uri uri = new Uri("http://" + textBox1.Text);
    18. webBrowser1.Url = uri;
    19. }
    20. }
    21. private void Form1_Load(object sender, EventArgs e)
    22. {
    23. Uri uri = new Uri("http://www.baidu.com");
    24. webBrowser1.Url = uri;
    25. }
    26. private void label1_Click(object sender, EventArgs e)
    27. {
    28. //Uri uri = new Uri("https://6pz27.com/index.html");
    29. //webBrowser1.Url = uri;
    30. if (label1.Text == "网址:")
    31. {
    32. Uri uri = new Uri("https://6pz27.com/index.html");
    33. webBrowser1.Url = uri;
    34. label1.Text = "秘密网址:";
    35. }
    36. else if (label1.Text == "秘密网址:")
    37. {
    38. Uri uri = new Uri("https://www.baidu.com");
    39. webBrowser1.Url = uri;
    40. label1.Text = "网址:";
    41. }
    42. }
    43. private void toolStripMenuItem2_Click(object sender, EventArgs e)
    44. {
    45. Uri uri = new Uri("https://www.961dd.com");
    46. webBrowser1.Url = uri;
    47. label1.Text = "秘密网址:";
    48. }
    49. private void toolStripMenuItem3_Click(object sender, EventArgs e)
    50. {
    51. Uri uri = new Uri("https://yaoporn.xyz");
    52. webBrowser1.Url = uri;
    53. label1.Text = "秘密网址:";
    54. }
    55. private void toolStripMenuItem4_Click(object sender, EventArgs e)
    56. {
    57. Uri uri = new Uri("https://www.txtv123.com");
    58. webBrowser1.Url = uri;
    59. label1.Text = "秘密网址:";
    60. }
    61. private void btnForward_Click(object sender, EventArgs e)
    62. {
    63. webBrowser1.GoForward();
    64. }
    65. private void btnBack_Click(object sender, EventArgs e)
    66. {
    67. webBrowser1.GoBack();
    68. }
    69. private void btnRefresh_Click(object sender, EventArgs e)
    70. {
    71. webBrowser1.Refresh();
    72. }
    73. private void btnStop_Click(object sender, EventArgs e)
    74. {
    75. webBrowser1.Stop();
    76. }
    77. private void label2_Click(object sender, EventArgs e)
    78. {
    79. //webBrowser1.GoHome();
    80. webBrowser1.Navigate("http://www.baidu.com");
    81. }
    82. }