private void ratioListView_KeyDown(object sender, KeyEventArgs e) { if (ratioListView.SelectedItems.Count == 0) { return; } ListViewItem item = ratioListView.SelectedItems[0]; int index = (int)item.Tag; if (e.KeyCode == Keys.Delete) { // Remove torque ratio Ratios.RemoveAt(index); // Flag change RatiosChanged = true; // Force Points Redraw PopulateTorqueRatios(); // Force a chart redraw torqueBox_ValueChanged(this, EventArgs.Empty); e.Handled = true; } else if (e.KeyCode == Keys.Enter) { TorqueRatio ratio = Ratios[index]; using (TorqueCurveForm frm = new TorqueCurveForm((int)torqueBox.Value, ratio)) { // Show form var result = frm.ShowDialog(); if (result == DialogResult.Yes) { // Grab Ratio TorqueRatio values = frm.GetRatio(); // Create the new Ratio ratio.RpmLevel = values.RpmLevel; ratio.Ratio = values.Ratio; // Flag change RatiosChanged = true; // Force Points Redraw PopulateTorqueRatios(); // Force a chart redraw torqueBox_ValueChanged(this, EventArgs.Empty); } } e.Handled = true; } }
private void removePointButton_Click(object sender, EventArgs e) { if (ratioListView.SelectedItems.Count == 0) { return; } // Remove torque ratio ListViewItem item = ratioListView.SelectedItems[0]; int index = (int)item.Tag; Ratios.RemoveAt(index); // Flag change RatiosChanged = true; // Force Points Redraw PopulateTorqueRatios(); // Force a chart redraw torqueBox_ValueChanged(this, EventArgs.Empty); }