private void trackBar1_ValueChanged(object sender, EventArgs e) { nplay = Math.Min(Rldats.ROV_LOG_DATA_List.Count - 1, trackBar1.Value - 1); // runtime = Rldats.ROV_LOG_DATA_List[nplay].RunTime; if (nplay >= 0) { RLDATp = Rldats.ROV_LOG_DATA_List[nplay]; } if (nplay < Rldats.ROV_LOG_DATA_List.Count - 1) { runtime2 = Rldats.ROV_LOG_DATA_List[nplay + 1].RunTime; } else { } runtime = RLDATp.RunTime; refreshMark = true; label1.Text = (nplay + 1).ToString() + "/" + Datlen.ToString(); }
private void timer1_Tick(object sender, EventArgs e) { if (DatasIsOK) { if (loadM) { trackBar1.Maximum = Datlen; if (Datlen <= 0) { return; } trackBar1.Value = 1; nplay = 0; runtime = Rldats.ROV_LOG_DATA_List[nplay].RunTime; this.Text = "重播器:" + FileName + "::" + Rldats.beginTime.ToString(); if (Datlen >= 1) { nplay = 0; // refreshMark = true; //更新第一帧 RLDATp = Rldats.ROV_LOG_DATA_List[nplay]; refreshMark = true; } if (Datlen > 1) { runtime2 = Rldats.ROV_LOG_DATA_List[1].RunTime; } loadM = false; } if (playM) { if (nplay + 1 < Datlen) { NowTime = DateTime.Now; Dtsp = NowTime - lastTime; Dt = Dtsp.TotalSeconds; if (runtime + Dt >= runtime2) { lastTime += Dtsp; runtime2 = Rldats.ROV_LOG_DATA_List[nplay + 1].RunTime; //更新 RLDATp = Rldats.ROV_LOG_DATA_List[nplay]; runtime = RLDATp.RunTime; refreshMark = true; nplay++; } } else { //更新 RLDATp = Rldats.ROV_LOG_DATA_List[nplay]; runtime = RLDATp.RunTime; refreshMark = true; playM = false; } trackBar1.Value = nplay + 1; label1.Text = (nplay + 1).ToString() + "/" + Datlen.ToString(); } //else //{ // lastTime = DateTime.Now; //} } }