private void InvertSelectionMenuItemClick(object sender, EventArgs e) { for (int i = 0; i < TracksListBox.Items.Count; i++) { TracksListBox.SetSelected(i, !TracksListBox.GetSelected(i)); } }
private void SelectAllMenuItemClick(object sender, EventArgs e) { if (TracksListBox.SelectionMode != SelectionMode.One) { for (int i = 0; i < TracksListBox.Items.Count; i++) { TracksListBox.SetSelected(i, true); } } }
private void TracksListBox_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } var index = TracksListBox.IndexFromPoint(e.Location); if (index != ListBox.NoMatches) { _selectedMenuItem = TracksListBox.Items[index] as Track; _contextMenuStrip.Show(Cursor.Position); _contextMenuStrip.Visible = true; } else { _contextMenuStrip.Visible = false; } }
public string GoToPrevious() { int selected = -1; if (TracksListBox.Items.Count > 0 && TracksListBox.SelectedIndex > 0) { selected = TracksListBox.SelectedIndex - 1; TracksListBox.ClearSelected(); TracksListBox.SelectedIndex = selected; } if (GetCurrent().Count > 0) { return(GetCurrent()[0]); } else { return(string.Empty); } }
public string GoToNext() { int selected = -1; if (TracksListBox.SelectedIndex != -1 && TracksListBox.SelectedIndex < TracksListBox.Items.Count - 1) { selected = TracksListBox.SelectedIndex + 1; TracksListBox.ClearSelected(); TracksListBox.SelectedIndex = selected; } if (GetCurrent().Count > 0) { return(GetCurrent()[0]); } else { return(string.Empty); } }
private void GoToActive_Click(object sender, RoutedEventArgs e) { TracksListBox.ScrollIntoView(TracksListBox.SelectedItem); }
private void SelectNoneMenuItemClick(object sender, EventArgs e) { TracksListBox.ClearSelected(); }