/// <summary>
        /// Called on mouse wheel event in the parent form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void MouseWheelMove(object sender, MouseEventArgs e)
        {
            if (Data == null)
            {
                return;
            }
            if (Data.Solution.SelectedFunction == null)
            {
                return;
            }
            if (e.Button != MouseButtons.None)
            {
                return;
            }
            if (dataGridView2.SelectedCells.Count <= 0)
            {
                return;
            }
            double shift = (100.0 + Convert.ToDouble(e.Delta / ((GetAsyncKeyState(Keys.ShiftKey) < 0) ? 120 : 12)));

            shift *= 0.01;
            try
            {
                foreach (DataGridViewCell dgvr in dataGridView2.SelectedCells)
                {
                    FitterParameter fp = Data.Solution.SelectedFunction.Parameters[dgvr.RowIndex];
                    switch (dgvr.ColumnIndex)
                    {
                    case 1:
                        fp.Value *= shift;
                        break;

                    case 2:
                        fp.MinLimit *= shift;
                        break;

                    case 3:
                        fp.MaxLimit *= shift;
                        break;

                    default:
                        double v0 = fp.Value * shift;
                        double v1 = fp.MinLimit * shift;
                        double v2 = fp.MaxLimit * shift;
                        fp.Value    = v0;
                        fp.MinLimit = v1;
                        fp.MaxLimit = v2;
                        break;
                    }
                    UpdateParameterRow(dgvr.RowIndex);
                }
            }
            catch {}
            if (DataFitter != null)
            {
                DataFitter.Plot_Picks();
            }
            ((HandledMouseEventArgs)e).Handled = true;
        }
        private void dataGridView2_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            FitterFunction ff = Data.Solution.SelectedFunction;

            if (ff == null)
            {
                return;
            }
            double value = 0.0;

            try
            {
                value = Convert.ToDouble(dataGridView2[e.ColumnIndex, e.RowIndex].Value);
            }
            catch
            {
                return;
            }
            FitterParameter fp = ff.Parameters[e.RowIndex];

            switch (e.ColumnIndex)
            {
            case 1:
                fp.Value = value;
                break;

            case 2:
                fp.MinLimit = value;
                break;

            case 3:
                fp.MaxLimit = value;
                break;

            default:
                break;
            }
            UpdateParameterRow(e.RowIndex);
            if (DataFitter != null)
            {
                DataFitter.Plot_Picks();
            }
        }
 private void button4_Click(object sender, EventArgs e)
 {
     if (Data == null)
     {
         return;
     }
     if (Data.Solution.SelectedFunction == null)
     {
         return;
     }
     foreach (DataGridViewRow dgvr in dataGridView2.Rows)
     {
         FitterParameter fp = Data.Solution.SelectedFunction.Parameters[dgvr.Index];
         double          p  = (fp.Value >= 0) ? fp.Value : -fp.Value;
         p          *= 0.1;
         fp.MinLimit = fp.Value - p;
         fp.MaxLimit = fp.Value + p;
         UpdateParameterRow(dgvr.Index);
     }
 }
        private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (Data == null)
            {
                return;
            }
            if (Data.Solution.SelectedFunction == null)
            {
                return;
            }
            FitterParameter fp = Data.Solution.SelectedFunction.Parameters[e.RowIndex];

            switch (e.ColumnIndex)
            {
            case 1:
                fp.MinLimit = fp.Value;
                fp.MaxLimit = fp.Value;
                break;

            case 2:
                fp.MinLimit = fp.Value;
                break;

            case 3:
                fp.MaxLimit = fp.Value;
                break;

            default:
                double p = (fp.Value >= 0) ? fp.Value : -fp.Value;
                p          *= 0.1;
                fp.MinLimit = fp.Value - p;
                fp.MaxLimit = fp.Value + p;
                break;
            }
            UpdateParameterRow(e.RowIndex);
        }