PictureBox的问题 [英] problem with PictureBox

查看:119
本文介绍了PictureBox的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的图片框有问题,我正在从网络摄像头获取流,在我的图片框中显示它,现在当我调用picturebox.refres()时,它可以正常工作,但在刷新方法后它不会执行代码,而是转到顶部该函数的功能.如果我不调用refresh方法,它将显示第一帧,然后显示带有白色背景的大红色X.下面的代码在事件处理程序中,它将新的帧提供给位图.

Hi
I am having a problem with my picture box i am getting stream from web cam displaying it in my picturebox, now when i call picturebox.refres() it works fine but it does not execute the code after refresh method instead it goes to the top of that function.If i dont call the refresh method it shows the first frame and then big red X with white background.The following code is in the eventhandler which gives new frames to bitmap.

currFrame = bitmap1;
bitmap1 = eventArgs.Frame;
copy = bitmap1;
Difference filter = new Difference(currFrame);
    // apply the filter
Bitmap resultImage = filter.Apply(copy);

pictureBox4.Image = resultImage;
pictureBox4.Refresh();
    //It works fine but it will not execute the code below refresh method

推荐答案

请改用pictureBox4.Invalidate().
http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.invalidate.aspx [ ^ ]

祝你好运!
Try pictureBox4.Invalidate() instead.
http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.invalidate.aspx[^]

Good luck!


这篇关于PictureBox的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆