如题,我想用picturebox实现图像的3秒内滚动播放,开始使用的timer但播放过程中发现
跳转到文件夹时速度越来越快,有没有大佬实现过,问一下思路
是不是你代码有问题, 是不是每次会重新创建timer, 造成多个timer 在运行。
我关掉之后,每次图片都不刷新,固定为同一张
@张飞吃豆芽: 你要自己检查下代码, 我说说没用的,具体问题要具体分析
@Tom.汤: 这是我的相关代码
timer= new System.Timers.Timer();
timer.Interval = 1000/curFrameRate;
int j = 0;
timer.Elapsed += delegate
{
j++;
play_pics(tmpPicsPath, j);
};
timer.AutoReset = true;
timer.Start();
this.progress.Text = curVideoTime.ToString();
}
private void play_pics(List<string> tmpPicsPath,int j)
{
Image image = Image.FromFile(tmpPicsPath[j]);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = image;
MessageBox.Show("j:" + j.ToString() + "count:" + tmpPicsPath.Count.ToString());
// pictureBox1.Refresh();
// MessageBox.Show(tmpPicsPath[j]);
if (j == tmpPicsPath.Count - 1)
{
j = 0;
MessageBox.Show("begin"); // 该段代码也没执行
}
@张飞吃豆芽:
timer.AutoReset = true; 这里为什么是true, 如果是true 就只执行一次了啊?
@Tom.汤: true为重复,false是一次
已经解决了,是我从视频取图的问题,谢谢啦