Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.linq;using system.text;using system.windows.forms;using system.io;namespace boxs{public partial class for M1:form {public Form1 () {InitializeComponent (); } list<string> A = new list<string> (); private void Button1_Click (object sender, EventArgs e) {OpenFileDialog od = new OpenFileDialog (); Od. Title = "XX"; Od. InitialDirectory = @ "C:\Documents and settings\administrator\ desktop"; Od. Filter = ""; Od. MultiSelect = true; Od. ShowDialog (); string[] names = od. FileNames; foreach (string path in Names) {string s_name = Path.getfilename (path); LISTBOX1.ITEMS.ADD (S_name); A.add (path); }} private void Listbox1_doubleclick (object SendeR, EventArgs e) {string ax = convert.tostring (A[listbox1.selectedindex]); Axwindowsmediaplayer1.url = ax; This.button2.Text = "Pause"; private bool B = false; private void Button2_Click (object sender, EventArgs e) {if (This.button2.Text = = "Play") { if (ListBox1.Items.Count < 1 | | listbox1.selectedindex<0) {MESSAGEBOX . Show ("The Code is wrong"); Return if (b) {b = false; } else {String ax = convert.tostring (A[this.listbox1.selectedindex]); Axwindowsmediaplayer1.url = ax; } axWindowsMediaPlayer1.Ctlcontrols.play (); This.button2.Text = "Pause"; } else {axWindowsMediaPlayer1.Ctlcontrols.pause (); This.button2.Text = "Play"; B = true; }} private void listBox1_SelectedIndexChanged (object sender, EventArgs e) {b = false; } }}
C # player