public void AddThumb(FFmpegResult ffmpegResult) { if (IsDisposed || thumbsContainer.IsDisposed) { return; } // Execute Add method in Thread context of the Form. this.Invoke((MethodInvoker) delegate { ThumbControl thumbControl = new ThumbControl(this, ffmpegResult); thumbsContainer.Controls.Add(thumbControl); UpdateProgress(); }); }
/// <summary> /// We have to use the 'ProcessCmdKey' method, /// the normal OnKeyDown/OnKeyUp/OnKeyPress methods don't work for the arrow keys. /// </summary> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (ActiveThumbControlIndex == -1) { return(false); } int nextSelectedThumbIndex = -1; switch (keyData) { case Keys.Left: nextSelectedThumbIndex = ActiveThumbControlIndex - 1; break; case Keys.Up: nextSelectedThumbIndex = ActiveThumbControlIndex - GetNumItemsRow(); break; case Keys.Right: nextSelectedThumbIndex = ActiveThumbControlIndex + 1; break; case Keys.Down: nextSelectedThumbIndex = ActiveThumbControlIndex + GetNumItemsRow(); break; default: return(base.ProcessCmdKey(ref msg, keyData)); } if (nextSelectedThumbIndex >= 0 && nextSelectedThumbIndex < Controls.Count) { ThumbControl newThumbControl = Controls[nextSelectedThumbIndex] as ThumbControl; if (newThumbControl != null) { newThumbControl.SelectThumb(); } } return(true); }
public void ThumbSelected(ThumbControl videoThumbControl) { thumbsContainer.ScrollControlIntoView(videoThumbControl); thumbsContainer.ActiveThumbControlIndex = thumbsContainer.Controls.GetChildIndex(videoThumbControl); }