"Program Development Small Remember" VB. NET music player

Source: Internet
Author: User

Written in the previous words:

In order to create a good communication learning environment, but also to meet the school graduation design needs, opened a blog park. At the beginning of next semester, the progress of graduation design will be updated every week. Blog has been opened, in order to exchange learning, only to update the graduation design progress seems a little contrived. Bloggers are not good-looking books to write a small comment on the Zhu Er, so I do not know and content to contribute to this, had to be in the course or internship in the development of the program here to do a brief description.

Because these projects are also Bo master painstaking efforts, but also afraid of some learn younger sister directly exactly shown caused trouble, inconvenience will source unchanged here, only to do a brief description.

If you are willing to exchange your studies, you can leave a contact information in comments or private messages.

Not much to say, next straight to the subject.

When we first received this topic, I had the following requirements:

① the need to complete the Windows program;

② interface design Beautiful, warm and harmonious/cool eye-catching;

③ in the user operation, there are user-provided operation tips and feedback information display;

④ can realize the main audio files such as MP3 Open, play, pause, stop;

⑤ can manage the play queue, can add, delete, adjust order and so on, can save multiple playlists;

⑥, on the basis of completing the necessary functions, can communicate the students ' ideas with the teacher, and further design more functions related to music file playback after being confirmed.

For the requirements of 6, with the teacher to communicate, the music player added lyrics synchronization function.

After the demand analysis, the following functions are obtained:

Familiar with the VB language students see here believe that the program has a general idea, it is true that the development of music player is not difficult, can learn a lot of examples of reference, but vb.net in the use of control and VB there is a great difference, I believe this is also the same use of vb.net developed classmates common pain.

On the other, music playback control module, to achieve music media files play, pause, switch and other specific functions, to provide better user interaction with the music control interface, music file Player tool and façade. Music playback control module as a music control tool, mainly through the WindowsMediaPlayer control implementation. Multimedia applications are a very important type of application, but the. NET environment does not have a self-contained multimedia control. The WindowsMediaPlayer control used in this internship is not a control that comes with the system IDE environment, but is a common and important control. With this control, we can write examples of multimedia playback and control the various states of music playback.

Music list management, is the music file player axis. The effective management music playlist, is the realization music free to switch, the free addition and so on function premise. Implement this section and choose to implement with the DataGridView Control. Many tutorials and network resources use the ListBox control when accomplishing similar tasks. Using the ListBox control to call multiple simultaneous records of the song file name, URL and other information, this operation cumbersome, and not conducive to unified management, users can not intuitively see the various information of the song. Now with the DataGridView Control, the DataGridView control belongs to the data control, which has obvious advantages in implementing data management. The DataGridView control can add multiple columns, and the control can sort the data by its own name. In addition, after setting the SelectionMode property value of the DataGridView control to Fullrowselect, you can directly select all the information of the required song, that is, selecting the song filename is the file path of the selected song, reducing the tedious operation of the listbox to implement the function. The DataGridView control also makes it easy to save the added information in a single-file store that implements a list in an Excel table file.

The operation prompt and the feedback information display, mainly through the file version information to the user feedback form as well as some cases can display the bubble realization. is the main method to improve the interactive and friendly.

Show the design of the blogger in developing the project as follows:

Form1: (playback control form, music file player main interface)

AxWindowsMediaPlayer1: Multimedia control, directly used for playback, multiple calls.

Label1~12: The title, progress, total time, and other information displayed for the currently playing music, as well as some keystrokes.

NotifyIcon1: Tray icon display.

Picturebox1~5: Used primarily as a button setting.

Timer1~4: Used to listen to events, such as refreshing the current playback progress, to determine whether the playback stopped.

TRACKBAR1: Controls the volume size.

Form2: (playlist form)

DataGridView1: Record playlist. It is divided into two columns, which record file name and file path respectively.

LABEL1~4: The control key for the playlist.

OPENFILEDIALOG1: Used to import music files.

TIMER1~2: Used for monitoring of events.

FORM3: (about show feedback and version information form)

Label1~7: Used for text display.

LinkLabel1: Displays the creator email address to add a network link.

PictureBox1: Displays the player logo.

FORM4: (Desktop lyrics form)

Button1: Click to open the lyrics file.

DataGridView1: Import lyrics. Divided into two columns, the lyrics tag time and lyrics.

Label1~2: Displays the current time and lyrics.

OpenFileDialog1: Lyrics file.

Timer1~2: Listen for events.

There may be difficult parts, in the blogger's view is only a playlist read and write, the next part of the source code, can be used for reference to learn from you.

Playlist import (when enabled):

Private SubTimer2_tick (Sender as ObjectE asEventArgs)HandlesTimer2.tick'Start stage List Import        If Dir("d:\bofangliebiao.xlsx", Fileattribute.normal) <>""  Then            DimMyexcel as NewMicrosoft.Office.Interop.Excel.Application () myexcel.visible=FalseMyExcel.Application.Workbooks.Open ("d:\bofangliebiao.xlsx")            DimI as Integer=1             fori =2  toMyexcel.worksheets (1). Usedrange.rows.count DataGridView1.Rows.Add (Myexcel.worksheets (1). Cells (I,1). Value, Myexcel.cells (i,2). Value)Nexti MyExcel.Workbooks.Close ()End If

Playlist save (when off):

 Private SubLabel6_click (Sender as ObjectE asEventArgs)HandlesLabel6.click'Close button ()        DimMyexcel as NewMicrosoft.Office.Interop.Excel.Application () MyExcel.Application.Workbooks.Add (True) myexcel.visible=False        DimM as Integer         form =0  toForm2.DataGridView1.ColumnCount-1Myexcel.cells (1, M +1) =Form2.DataGridView1.Columns (M). HeaderTextNextm'add data to the Excel table ()        DimI as Integer         fori =0  toForm2.DataGridView1.RowCount-2            DimJ as Integer             forj =0  toForm2.DataGridView1.ColumnCount-1                IfForm2.datagridview1 (J, i). Value isSystem.DBNull.Value ThenMyexcel.cells (i+2, J +1) =""                ElseMyexcel.cells (i+2, J +1) =Form2.datagridview1 (J, i). Value.tostringEnd If            NextJNextIIf Dir("d:\bofangliebiao.xlsx", Fileattribute.normal) <>""  Then            Pager Kill("d:\bofangliebiao.xlsx")        End IfMyExcel.ActiveWorkbook.SaveAs ("d:\bofangliebiao.xlsx") MyExcel.Workbooks.Close ()'Form2. Table 1tableadapter.fill (form2.playlistdataset. 1)        'Form2. Table 1tableadapter.update (Form2.playlistdataset)        Me. Close ()End Sub

Of course, the lyrics synchronization is also very difficult, bloggers in writing this part of the time also met a lot of problems, and now deal with the words are some small bugs, do not post out, there is exchange can private chat me.

Write here, show the blogger's interface, which was written in the report with a feature description:

Finally, recommend a project packaging (installation package production) software to everyone: Advanced installer

Welcome to the exchange of HA ~

"Program Development Small Remember" VB. NET music player

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.