private void timerGetPlayInfo_Tick(object sender, EventArgs e) { uint playedFrameNum = DHPlay.DHPlayControl(PLAY_COMMAND.GetCurrentFrameNum, 0, true); uint playedTime = DHPlay.DHPlayControl(PLAY_COMMAND.GetPlayedTime, 1, true); //f/s lblCurrentFrame.Text = Convert.ToString(playedFrameNum); //valor de trackbar + valor en segundos de los segundos transcurridos trbPlayFrames.Value = positionValue + secondsToTrbValue((int)playedTime, segundosTotales); // (*) El valor del trakbar se pasa a segundos segun la duracion del video int segundos = trbValueToSeconds(trbPlayFrames.Value, segundosTotales); //tiempo transcurrido orig lblCurrentTime.Text = DHPlay.DHConvertToTime(playedTime, 1, "HH:MM:SS"); //Se agrega el cálculo (*) al tiempo transcurrido DateTime timeAux = Convert.ToDateTime(lblCurrentTime.Text); timeAux = timeAux.AddSeconds(segundos); lblfechaaux.Text = timeAux.ToString("HH:mm:ss"); lblCurrentTime.Text = lblfechaaux.Text; }
/// <summary> /// 设置当前的播放属性 /// </summary> /// <param name="playedFrameNum"></param> /// <param name="playedTime"></param> private void SetPlayCurrentInfo(UInt32 playedFrameNum, UInt32 playedTime) { stlCurrentFrame.Text = Convert.ToString(playedFrameNum + 1); stlCurrentTime.Text = DHPlay.DHConvertToTime(playedTime, 1, "HH:MM:SS"); trbPlayFrames.Value = (int)(playedFrameNum < trbPlayFrames.Maximum ? playedFrameNum : 0); if (trbPlayFrames.Maximum <= playedFrameNum + 1) { mnuStop_Click(null, null); if (blnLoop) { mnuStart_Click(null, null); } } }
/// <summary> /// 打开录像文件菜单处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuOpenFile_Click(object sender, EventArgs e) { if (ofdMain.ShowDialog() == DialogResult.OK) { if (DHPlay.DHPlayControl(PLAY_COMMAND.OpenFile, 0, ofdMain.FileName)) { SetOpenCloseFileControl(1); stlTotalTime.Text = DHPlay.DHConvertToTime(DHPlay.DHPlayControl(PLAY_COMMAND.GetFileTotalTime, 0, true), 1, "HH:mm:ss"); bool blnReturn = DHPlay.DHPlayControl(PLAY_COMMAND.GetColor, 0, (uint)picPlayMain.Handle, ref pColor); if (blnReturn) { hsbBrightness.Value = pColor.pBrightness; hsbContrast.Value = pColor.pContrast; hsbHue.Value = pColor.pHue; hsbSaturation.Value = pColor.pSaturation; } trbSound.Value = (int)DHPlay.DHPlayControl(PLAY_COMMAND.GetVolume, 0, true); } else { MessageBox.Show("打开文件失败!", pMsgTitle); } } }