首页 新闻 会员 周边 捐助

关于timer问题

0
悬赏园豆:10 [已关闭问题] 关闭于 2012-04-11 15:29

急急急!最近自己写了个播放器用到了timer来控制进度条(tarckBar)问题。自己思考了不会做。下面是代码:就是红色部分,若不用timer1.Start()则播放正常,一用到timer1.start(),播放了几帧就直接跳到最后播放完毕那里了。请各位帮我看看呀。

 private void tsmiOpenFile_Click(object sender, EventArgs e)
        {
            string filePath="";       
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.Filter = "MedioFile|*.264;*.dav;|AllFiles|*.*";
            if (DialogResult.OK == fileDialog.ShowDialog())
                filePath = fileDialog.FileName;           
            player.OpenFile(filePath);                   
            lblMessage.Text = player.FiledMessage;           
            tbarPlay.Maximum = Convert.ToInt32(player.TotalTime.TotalSeconds);
            tbarPlay.Minimum = 0;
            tsmiCloseFrame.Enabled = true;         
            player.Play();
            timer1.Start();           
        }   

 private void timer1_Tick(object sender, EventArgs e)
        {
            int tbrValue=Convert.ToInt32(player.PlayedTime.TotalSeconds);
            if (player.PlayState != PlayStates.Stopped || player.PlayState != PlayStates.Paused)
            {
                if (tbrValue> tbarPlay.Maximum)
                    tbrValue = tbarPlay.Maximum;
                if (tbrValue < tbarPlay.Minimum)
                    tbrValue = tbarPlay.Minimum;
                tbarPlay.Value = tbrValue;
                lblNowToTolelTime.Text = player.PlayedTime.ToString() + "/" +      player.TotalTime.ToString();
                lblNowToTotelFrame.Text = player.PlaydeFrameNumber.ToString() + "/" + player.TotalFrame.ToString();
            }
           
        }     

菱子的主页 菱子 | 初学一级 | 园豆:129
提问于:2012-04-11 15:23
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册