简体   繁体   中英

One of three PictureBoxes does not update

Background:

My program is live video winform application. I have three PictureBox on my form. Those picture boxes are automatically resized according to their parent form size. A thread in my program updates those picture box with three 2048x2048 images from 30 fps camera using safe Invoke method.

Problem:

When the form is small enough, all three pictureboxes display fine although the problematic picture box is little slower than the others. But if the form gets bigger, just one of picture boxes not updated while the other two are updated well. FYI, those pictures are pushed into the pixture boxes at the same time. It may sound silly but the problamatic picture box looks defective

Question:

I would like to understand why this symptom occurs - Same-size picture boxes got same size of images at the same time but only one of them is not updated. Is this video card problem? Is there any way to fix this?

尝试使用C#开源ispy软件http://www.ispyconnect.com/

Update:

As I think this is a problem with form refresh, I created a thread to periodically refresh my form. And I think the non-update problem is resolved.

    private void MyForm_Load(object sender, EventArgs e)
    {
        Thread thread = new Thread(() =>
        {
            while (!m_bFormClose)
            {
                this.SafeInvoke(Refresh);
                Thread.Sleep(500);
            }
        });
        thread.Start();
    }

I guess I can do this with timer but I feel more safe with thread. If you have a better way, please comment or answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM