//搜索 private void buttonSearch_Click(object sender, EventArgs e) { if (textBoxSearch.Text == "") { return; } FormSearchResult formSearchResult = new FormSearchResult(textBoxSearch.Text, radioButtonSearchByName.Checked); if (formSearchResult.ShowDialog() == DialogResult.OK) { if (formSearchResult.StrMusicianName == "" || formSearchResult.StrAlbumName == "" || formSearchResult.StrMusicName == "") { return; } //listViewMusicList.Items.Clear(); //将搜索到的结果显示出来,定位到系列、专辑和音乐,自动播放 // for (int i = 0; i < comboBoxMusicianList.Items.Count; i++) { if (comboBoxMusicianList.Items[i].ToString() == formSearchResult.StrMusicianName) { comboBoxMusicianList.SelectedIndex = i; break; } } //Thread.Sleep(1000); for (int i = 0; i < comboBoxAlbumList.Items.Count; i++) { if (comboBoxAlbumList.Items[i].ToString() == formSearchResult.StrAlbumName) { comboBoxAlbumList.SelectedIndex = i; break; } } //Thread.Sleep(1000); for (int i = 0; i < listViewMusicList.Items.Count; i++) { if (listViewMusicList.Items[i].Text == formSearchResult.StrMusicName) { listViewMusicList.Items[i].Selected = true; break; } } //Thread.Sleep(1000); } formSearchResult.Dispose(); }