当我调试捕获按钮代码行一行它捕获图像,但当我删除调试点并运行应用程序并单击捕获按钮它不捕获图像 [英] When I Debug Capture Button Code Line By Line It Capture Image But When I Remove Debug Point And Run Application And Click On Capture Button It Was Not Capturing Image
本文介绍了当我调试捕获按钮代码行一行它捕获图像,但当我删除调试点并运行应用程序并单击捕获按钮它不捕获图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void btnCaptureIage_Click(object sender, EventArgs e)
{
webBrowser1.Select();
Application.DoEvents();
Bitmap bitmap = new Bitmap(webBrowser1.Width, webBrowser1.Height);
webBrowser1.DrawToBitmap(bitmap, new Rectangle(0, 0,
webBrowser1.Width,webBrowser1.Height));
pictureBox1.BackgroundImage = bitmap;
Application.DoEvents();
}
推荐答案
在WebBrowser控件上使用此方法遇到问题并不是唯一的问题:它是一种方法Microsoft告诉您不要使用的内部使用:[ ^ ]。
而且,是的,这是一个合乎逻辑的问题:为什么,如果它不打算被凡人使用,它是否可用?
这是另一种方法:[ ^ ]; imho,这整个StackOverFlow线程非常值得研究。
You are not alone in experiencing problems with using this method on the WebBrowser Control: it's a method meant for internal use that Microsoft tells you not to use: [^].
And, yes, this is a logical question to ask: why, if it is not meant to be used by "mere mortals," is it made available ?
Here's another approach: [^]; imho, this entire StackOverFlow thread is well worth studying.
这篇关于当我调试捕获按钮代码行一行它捕获图像,但当我删除调试点并运行应用程序并单击捕获按钮它不捕获图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文