110,535
社区成员
发帖
与我相关
我的任务
分享
//定义
private int ThisIndex = 0;
private int ThisAll = 0;
//更新进条事件。就是Timer的事件
public void Time()
{
if (is_playinig_)
{
if (ThisIndex == ThisAll)//播放结束
{
DemoPlayer.Stop();
Timer.Stop();
LabelPlayTime.Text = "00:00:00 / 00:00:00";
PlayProgressBar.Value = 0;
}
else
{
ThisIndex++;
double alnun = Convert.ToDouble(ThisIndex) / Convert.ToDouble(ThisAll);
double alnum2 = alnun * Convert.ToDouble(1000);
PlayProgressBar.Value = (int)alnum2;
LabelPlayTime.Text = string.Format("{0} / {1}",
GetTimeString(ThisIndex),
GetTimeString(ThisAll));
}
}
}
//点击滑动条事件
private void PlayProgressBar_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
double mousetime = e.X;
double time = (mousetime / 1000) * ThisAll;
DemoPlayer.SetPlayTime(time);
PlayProgressBar.Value = (int)mousetime;
ThisIndex = (int)time;
}
}