日期:2014-05-17 浏览次数:20763 次
WebBrowser m_WebBrowser = null;
private void _GenerateHtmlToImgImage()
{
m_WebBrowser = new WebBrowser();
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
t.Enabled = false;
t.Interval = 10000;
t.Tick += t_Tick;
m_WebBrowser.ScrollBarsEnabled = false;
t.Enabled = true;
m_WebBrowser.Navigate(m_Url);
m_WebBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(WebBrowser_DocumentCompleted);
while (m_WebBrowser != null && m_WebBrowser.ReadyState != WebBrowserReadyState.Complete)
Application.DoEvents();
if (m_WebBrowser != null)
m_WebBrowser.Dispose();
m_WebBrowser = null;
}
void t_Tick(object sender, EventArgs e)
{
((System.Windows.Forms.Timer)sender).Stop();
WebBrowser tmp = m_WebBrowser;
if (tmp != null)
{
m_WebBrowser = null;
if (tmp.ReadyState != WebBrowserReadyState.Complete)
{
tmp.Stop();
tmp.Dispose();
}
}
WebBrowser tmp = m_WebBrowser;
if (t