zoukankan      html  css  js  c++  java
  • c# pictureBox 循环播放图片

    c#

    1.遍历目录 查找图片
    2.在 pictureBox 循环播放

    
    public void PlayThread()//CMD_UpdateBtnStatus cmd
            {
                Int32 framerate = 30;
                Int32 interval = 1000 / framerate;
    
                string suffix = "*.jpg";
                List<String> list = Utility.TraverseDirector(videoFramePath, false, true, suffix);
                if (list.Count == 0)
                {
                    return;
                }
    
                UInt32 count = (UInt32)list.Count;
    
                while (_ImagePlayThreadLoop)
                {
                    for (UInt32 index = 0; index < count; index++)
                    {
                        //this.Invoke((EventHandler)(delegate   //数据返回错误
                        //{
                        //Tab4_UVC_pictureBox.Load(list[(Int32)index]); //同步方式 必须要delegate 方式更新(手动添加 异步方式)
                        //不能在这里sleep 会卡死UI线程
                        //}));
    
                        //直接用异步方式,更新图片数据
    
                        //文件不存在就continue;
                        if (!File.Exists(list[(Int32)index])) continue;
    
                        Tab4_UVC_pictureBox.LoadAsync(list[(Int32)index]);
    
                        if (!_ImagePlayThreadLoop)
                        {
                            index = count;
                            //continue;
                            return;
                        }
                        if (index >= count)
                        {
                            index = 0;
                        }
                        Thread.Sleep(interval);
                    }
                }
            }
    
  • 相关阅读:
    linux 软件多版本共存
    git new
    centos 7 重新设置分区大小
    yum 多线程插件,apt多线程插件
    配置opencv cmake
    cmake 配置
    OpenCV 静态库 CMAKE 文件
    cron
    开课啦
    pytorch转onnx问题
  • 原文地址:https://www.cnblogs.com/scotth/p/10118104.html
Copyright © 2011-2022 走看看