我试图取消选中“启用Visual Studio托管过程”,这是在调试选项卡下,我关闭并打开可视工作室但它仍然无法正常工作。此外,我还在管理员模式下运行网页。
这是我的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace WebPage1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void toolStripButton4_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(toolStripTextBox1.Text);
}
public void toolStripButton1_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}
public void toolStripButton2_Click(object sender, EventArgs e)
{
webBrowser1.GoForward();
}
public void toolStripButton3_Click(object sender, EventArgs e)
{
webBrowser1.Refresh();
}
public void toolStripButton5_Click(object sender, EventArgs e)
{
webBrowser1.Stop();
}
public void toolStripButton6_Click(object sender, EventArgs e)
{
webBrowser1.GoHome();
}
public void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
try
{
toolStripProgressBar1.Value = Convert.ToInt32(e.CurrentProgress);
toolStripProgressBar1.Maximum = Convert.ToInt32(e.MaximumProgress);
}
catch(Exception ex)
{
//MessageBox.Show(ex.Message);
}
}
private void webBrowser1_Navigate(object sender, WebBrowserNavigatedEventArgs e)
{
}
public void button1_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Direct to Google", "Go", MessageBoxButtons.OK) == DialogResult.Yes)
{
System.Diagnostics.Process.Start("https://www.google.com.sg/");
Console.WriteLine("Running");
System.Diagnostics.Trace.WriteLine("run");
}
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//System.Diagnostics.Process.Start("https://www.google.com.sg/");
// Console.WriteLine("Running");
}
private void Form1_Load(object sender, EventArgs e)
{
//System.Diagnostics.Process.Start("https://www.google.com.sg/");
//Console.WriteLine("Running");
}
}
}