我使用的是Visual Basic 9(VS2008)和TagLib。使用TagLib從MP3文件中提取專輯封面 - 有沒有更好的方法來寫這段代碼?
以下代碼從MP3文件中提取專輯封面並將其顯示在PictureBox中。
有沒有更好的方法來寫這段代碼?
Dim file As TagLib.File = TagLib.File.Create(filepath)
If file.Tag.Pictures.Length >= 1 Then
Dim bin As Byte() = DirectCast(file.Tag.Pictures(0).Data.Data, Byte())
PreviewPictureBox.Image = Image.FromStream(New MemoryStream(bin)).GetThumbnailImage(100, 100, Nothing, System.IntPtr.Zero)
End If
乍一看,代碼看起來OK我。你有問題嗎? – hmcclungiii 2009-01-24 14:57:57