且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在gridview中单击.mp3文件的名称来播放.mp3文件?

更新时间:2023-01-18 16:50:19

你好

1.创建一个具有2个属性FileNameFilePath
的类(SoundFile)
2.创建列表
Hello

1. Create a Class (SoundFile) that has 2 properties FileName, FilePath

2.Create a List
List<SoundFile> FileList = new List<SoundFile>();


3.初始化FileList

4.将列表绑定到GridView

5.在SelectedInexChanged中,获取SelectedItem及其名称和路径,然后即可播放.

我建议阅读这篇文章:
C#中的低级音频播放器

并查看链接:
使用C#播放MP3文件
通过c#播放mp3 (请注意SAKryukov的回答)


3. Initialize FileList

4. Bind the List to the GridView

5. In SelectedInexChanged Get the SelectedItem and it''s name and path, then you can play it.

I suggest to read this article:
A low-level audio player in C#

And Look at the links:
Play MP3 Files Using C#
playing mp3 through c# (Pay attention to SAKryukov''s answer)