private void FormPlayer_Load(object sender, EventArgs e) { imageCroppingBox1._Image = pictureBox1; imageCroppingBox1.onMove = me => { showCropInfo(); }; labelTime.Text = ""; this.myProgressBar1.addControlMove(labelTime); this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseWheel); myProgressBar1.onMove = () => { isDragging = true; FFplay.ffplay_set_position(FFplay.ffplay_get_duration() * myProgressBar1.Value / myProgressBar1.Maximum); }; myProgressBar1.onUp = () => { isDragging = false; }; if (onLoad != null) { this.BeginInvoke(onLoad); } }
private void timer1_Tick(object sender, EventArgs e) { try { var dur = FFplay.ffplay_get_duration(); var state = FFplay.ffplay_get_state(); if (state == 1) { buttonPause.Text = dfv.lang.dat.Pause; } else { buttonPause.Text = dfv.lang.dat.Play; } var time = FFplay.ffplay_get_position(); labelTime.Text = dfv.timeToStr2(time) + " / " + dfv.timeToStr2(dur); if (dur < 1 || isDragging || state == 0) { return; } myProgressBar1.setValue((int)(time * 1000 / dur)); } catch (Exception err) { timer1.Stop(); dfv.msgERR(err.Message); } }