I. Design ideas
The program requires the ability to play the MP3 file, so call the play method in the library: Right-click the toolbox selection, add COM components, select Window Media Player, and the Toolbox will have one more control and then drag onto the form to OK. Also put several Buttoon buttons in the form to achieve pause \ Play, stop and other functions. Finally, the song path is displayed in the TextBox.
Two. Code implementation
1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Drawing;6 usingSystem.Linq;7 usingSystem.Text;8 usingSystem.Windows.Forms;9 usingSystem.IO;Ten usingSystem.Drawing.Imaging; One A namespaceMP3 player - { - Public Partial classForm1:form the { - PublicForm1 () - { - InitializeComponent (); + } - \ \ Select the MP3 file to play and play it automatically + Private voidButton1_Click (Objectsender, EventArgs e) A { atOpenFileDialog Dialg =NewOpenFileDialog (); -Dialg. AddExtension =true; -Dialg. Checkfileexists =true; -Dialg. Checkpathexists =true; -Dialg. Filter ="MP3 file (*.mp3) |*.mp3"; -Dialg. DEFAULTEXT ="*.mp3"; inaxwindowsmediaplayer1.settings.autostart=true; - if(Dialg. ShowDialog () = =DialogResult.OK) to { +Axwindowsmediaplayer1.url =Dialg. FileName; - } theTextBox1.Text =Dialg. FileName; * $ } Panax Notoginseng - \ Stop button the Private voidButton2_Click (Objectsender, EventArgs e) + { A the axWindowsMediaPlayer1.Ctlcontrols.stop (); +MessageBox.Show ("after playback, the file is closed. "); - } $ \ \ Play & pause button $ Private voidButton4_Click (Objectsender, EventArgs e) - { - the intI= (int) axwindowsmediaplayer1.playstate; - if(i = =2)Wuyi { the AxWindowsMediaPlayer1.Ctlcontrols.play (); - } Wu Else - { About axWindowsMediaPlayer1.Ctlcontrols.pause (); $ - } - A } + the - $ the } the}
Three. Testing
Four. PSP Time-consuming analysis
Five. Team Programming summary
This is the first time to do a team programming project, there are many areas between the team did not fit in place, but eventually did come out. after This team work, we come to a conclusion: the Division of labor must be clear, to let the team members to choose their own areas of expertise, so as to fully develop the ability of the individual to improve the overall team.
Six. Team members
Name Study Number Division score
Captain: Lu Gui-Ho 1076 Code writing 3
Members: Cheng Jiaqing 1005 PSP Time-consuming analysis 1
Cheng Guo 1004 Form Design 2
Li Meng 1044 Code Review 1
Ms. Squealing 1103 Code Specification 2
Li Fei 1170 Code Test 1
MP3 player team project