C#如何获取((WebBrowser)sender).Print()内容? 5
下面的代码会直接跳出我要的内容。但是实际上我还要对这些内容进行处理,所以想将其保存到变量当中,求大神指点如何操作。privatevoidPrintHelpPage(){/...
下面的代码会直接跳出我要的内容。但是实际上我还要对这些内容进行处理,所以想将其保存到变量当中,求大神指点如何操作。
private void PrintHelpPage()
{ // Create a WebBrowser instance.
WebBrowser webBrowserForPrinting = new WebBrowser();
// Add an event handler that prints the document after it loads. webBrowserForPrinting.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PrintDocument);
// Set the Url property to load the document.
webBrowserForPrinting.Url = new Uri("***");
}
private void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e)
{
MessageBox.Show("000"); MessageBox.Show(((WebBrowser)sender).Document.GetElementById("sljaqi").InnerHtml);
//不可以用InnerItem // Print the document now that it is fully loaded.
//((WebBrowser)sender).Print();
// Dispose the WebBrowser now that the task is complete.
((WebBrowser)sender).Dispose();
} 展开
private void PrintHelpPage()
{ // Create a WebBrowser instance.
WebBrowser webBrowserForPrinting = new WebBrowser();
// Add an event handler that prints the document after it loads. webBrowserForPrinting.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PrintDocument);
// Set the Url property to load the document.
webBrowserForPrinting.Url = new Uri("***");
}
private void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e)
{
MessageBox.Show("000"); MessageBox.Show(((WebBrowser)sender).Document.GetElementById("sljaqi").InnerHtml);
//不可以用InnerItem // Print the document now that it is fully loaded.
//((WebBrowser)sender).Print();
// Dispose the WebBrowser now that the task is complete.
((WebBrowser)sender).Dispose();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询