如何在视频控制中为图片显示屏幕截图? [英] how do sleep for picture show in video control for screenshot?

查看:137
本文介绍了如何在视频控制中为图片显示屏幕截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用线程睡眠时,没有视频图片可以控制但只有音频声音,

when i use thread sleep, there is no video picture in control but only audio sound, 

但是删除睡眠,它可以在视频中显示图片,睡眠影响视频图片展示

but remove sleep, it can have picture show in video, sleep influence the video picture show

https://github.com/ZeBobo5/Vlc.DotNet

https://github.com/ZeBobo5/Vlc.DotNet

 public void Sleeping()
        {
            Thread.Sleep(5000);
        }
string path = Directory.GetCurrentDirectory();
                string[] lines = System.IO.File.ReadAllLines(path + "\\links.txt");
                string[] lines2 = System.IO.File.ReadAllLines(path + "\\links.txt");

                tableLayoutPanel1.ColumnCount = 10;
                tableLayoutPanel1.RowCount = 10;

                numberofline = 1;
                int colnum = 0;
                int rownum = -1;
                int dummy = 0;
                //numberofline = 0;
                while (true)
                {
                    numberofline = 0;
                    foreach (string line in lines)
                    {
                        if (numberofline > 0)
                        {
                            vlcControl1.SetMedia(line);
                            vlcControl1.Play();
                            Sleeping();
                            vlcControl1.Pause();
                            using (var bmp = new Bitmap(vlcControl1.Width, vlcControl1.Height))
                            {
                                vlcControl1.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
                                bmp.Save(path + "\\tv" + numberofline.ToString() + ".bmp");
                            }
                            vlcControl1.Stop();
                        }
                        numberofline = numberofline + 1;
                    }
                }

MEALY

推荐答案

我认为要创建线程来休眠并使布尔循环

i think to create thread to sleep and make boolean to loop

然后睡眠结束,然后失控。我不知道是否工作,明天晚上我会试试

and then sleep finish, then out of loop. i do not know whether work or not, i will try it tomorrow night


这篇关于如何在视频控制中为图片显示屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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