protected override void OnShown(EventArgs e) { AvailableTestListBox.Focus(); AvailableTestListBox.SelectedIndex = 0; if (TestProgramOpenEditIndex > -1) { TestProgramListBox.ClearSelected(); TestProgramListBox.SelectedIndex = TestProgramOpenEditIndex; if (EditTestAt(TestProgramOpenEditIndex)) { TestProgramListBox.Items[TestProgramOpenEditIndex] = TestProgram[TestProgramOpenEditIndex].GetDisplayText(); TestProgramListBox.Refresh(); } } if (TestProgramListBox.Items.Count == 0) { UpButton.Enabled = false; DownButton.Enabled = false; RemoveTestButton.Enabled = false; } base.OnShown(e); }
private void TestProgramListBox_MouseDown(object sender, MouseEventArgs e) { if ((ModifierKeys & Keys.Control) != Keys.Control) { TestProgramListBox.ClearSelected(); TestProgramListBox.SelectedIndex = TestProgramListBox.IndexFromPoint(e.X, e.Y); } else { TestProgramListBox.SetSelected(TestProgramListBox.IndexFromPoint(e.X, e.Y), true); } }
private void TestProgramListBox_DoubleClick(object sender, MouseEventArgs e) { for (int i = 0; i < TestProgramListBox.Items.Count; i++) { var rect = TestProgramListBox.GetItemRectangle(i); if (rect.Contains(e.Location)) { if (EditTestAt(i)) { TestProgramListBox.Items[i] = TestProgram[i].GetDisplayText(); TestProgramListBox.Refresh(); } break; } } }