如何显示10秒钟的图像然后在此之后将为空? [英] How to show image for 10 second period then will be null after that ?

查看:129
本文介绍了如何显示10秒钟的图像然后在此之后将为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题



如何显示图像10秒钟然后将为null?



我在Windows窗体上有TimerCount每秒钟在桌面成员上获取最后一张图像



这是工作成功在视觉工作室2017上使用Windows窗体计时器。



我需要检索新图像时显示此图像10秒然后将其设为空



problem

How to show image for 10 second period then will be null After that ?

I have TimerCount on windows form get last image on table members every second

and this is work success using windows form timer on visual studio 2017 .

and I need when new image retrieved show this image for 10 second then make it null

picturebox1.image=null





如果没有检索到新图像,那么之后将为null



如果TimerCount检索到的新图像不等于10,则在10秒内第二个



只有在十秒钟内没有检索到图像时才显示每10秒钟的图像



以及10第二个没有图像检索设置图像为空?



伪代码



After that will be null in case of not new image retrieved

and within 10 second if new image retrieved by TimerCount not wait for ten second

show image per 10 second only if no image retrieved within ten second

and if after 10 second no image retrieved set image to null ?

pseudo code

if(new image retrieved )
{
show it per 10 second 
}
if(after 10 second no image retrived)
{
picturebox1.image=null;
}
if(new image retrieved by timercount)
{
not wait until 10 second display for current image
}



你可以帮我或者给我这个想法吗?



我尝试过的事情:




can you help me or give me idea for that please ?

What I have tried:

private void TimerCount_Tick(object sender, EventArgs e)
        {
           
            TimerCount.Start();
            GetMembersDataImage();
               
        }

推荐答案

不要使用计时器。计时器事件是Windows系统上优先级最低的事件。使用线程来执行此操作。实际上,尝试使用BackgroundWorker目标来编组图像显示。如果这不起作用,请转到线程。如果您无法管理,请尝试使用React框架(谷歌是您的朋友)。
DON'T USE TIMERS. Timer events are the lowest priority event on a Windows system. Use threading to do this. In fact, try using a BackgroundWorker objecvt to marshall image display. If that doesn't work, move to threading. If you can't manage that, try the React framework (google is your friend).


这篇关于如何显示10秒钟的图像然后在此之后将为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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