有没有办法调试使用图片? [英] Is there a way to debug using pictures?
问题描述
我正在编写一个使用图片的程序。我处理一个图像(用函数说"function1()",在这个处理结束时我展示它
I am writing a program that uses pictures. I process an image (with a function say "function1()" and at the end of this processing I show it
picImage.Image = bmp;
一切进展顺利。但我现在想调试这个function1进程。这个过程涉及迭代,显示的图像是n次迭代后的结果。
Everything is going well. However I now want to debug this function1 process. This process involves a iteration, and the image that was shown is the result after n iterations.
我想通过显示图像每次迭代的变化来调试这个过程。
I would like to debug this process by showing how the image changes for every iteration.
然而在visual studio中我注意到在调试时,图像在操作结束并且GUI线程再次负责之前不会更新。例如,如果我在function1中以某种方式放置断点,并在bmp
上画一个十字,然后前进到picImage行上面,我执行它,图像仍然没有显示。我必须继续前进,直到GUI负责终于看到更新的图像
However in visual studio I have noticed that while debugging, the image does not get updated until the operation is concluded and the GUI thread is in charge again. So for example if I put a breakpoint somehow in function1, and I draw a cross on the bmp and then advance to the line with picImage above, and I execute it, the image still don't show. I have to keep advancing until the GUI is in charge to finally see the updated image
有没有办法,我可以看到更新的图像。换句话说,我可以调试图像(图片)吗?
Is there a way that I can see the updated image. In other words, can i debug with images (pictures)?
推荐答案
有没有办法可以看到更新的图像。换句话说,我可以调试图像(图片)吗?
Is there a way that I can see the updated image. In other words, can i debug with images (pictures)?
在这种情况下 - 例如,如果我需要检查,我的算法是否以正确的方式工作 - 我只是放了几行代码来输出一个或多个表格中的图片,如:
in such cases - eg, if I need to check, if my algorithm works the right way - I just put some lines of code to output the picture in a form or so, like:
if(y % 100 == 0) //if inside a loop
{
Form fff = new Form();
fff.BackgroundImage = myBmpWork; //the bmp I work on
fff.ShowDialog();
}
问候,
Thorsten
Thorsten
这篇关于有没有办法调试使用图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!