-2

看下面的代码

namespace WindowsFormsApplication1
{
public partial class myprogram : Form
{
    public myprogram()
    {            
        InitializeComponent();
    }

    WebKitBrowser wb1 = new WebKitBrowser();



     private void timer1_Tick(object sender, EventArgs e)
    {
        timer1.Enabled = false;
        wb1.Navigate("site.com");
        timer2.Enabled = true;
    }

    private void timer2_Tick(object sender, EventArgs e)
    {
        timer2.Enabled = false;
        wb1=null;    
        timer1.Enabled = true;
    }      
}
}

要每次清空 RAM,wb1 必须为空。但随后它变为空,不再命中并说它已经为空。那么如何在 timer2 中获取 null 然后在 timer1 中导航?

4

1 回答 1

0

添加wb1 = new WebKitBrowser();到 timer1_Tick

于 2018-12-01T06:52:28.283 回答