//右键打开选择文件 private void listBoxFile_MouseClick(object sender , MouseEventArgs e) { if(e.Button == MouseButtons.Right && listBoxFile.ClientRectangle.Contains(e.X , e.Y)) { int posindex = listBoxFile.IndexFromPoint(new Point(e.X , e.Y)); listBoxFile.ContextMenuStrip = null; if(posindex >= 0 && posindex < listBoxFile.Items.Count) { listBoxFile.SelectedIndex = posindex; contextMenuStrip1.Show(listBoxFile , new Point(e.X , e.Y)); } } listBoxFile.Refresh(); } 右键选中当前的item,并弹出popup窗口