private void AddVideoFrame(Point pMousePos) { try { int iMousePosition = ((this.Orientation == enumOrientation.orHorizontal) ? pMousePos.X : pMousePos.Y); long lMillisecond = CalculateMillisecondValue(iMousePosition); if( (lMillisecond >= _lStartMillisecond) && (lMillisecond <= _lEndMillisecond) ) { if(lMillisecond <= _lCurrentMillisecond) throw new System.Exception("You can not add new keyframes that occur before the current simulation time."); KeyFrame keyFrame = new KeyFrameVideoRange(lMillisecond, lMillisecond + 200); this.KeyFrames.Add(keyFrame); OnKeyFrameAdded(keyFrame); SelectedKeyFrame = keyFrame; } } catch(Exception ex) { MessageBox.Show(ex.Message); } }