本文介绍了WPF-带有图像的列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

how to add any number of album art into listbox?.this is my code
<pre lang="c#">
        BitmapFrame bmp = null;
        public int Getpic(string s)
        {

            img.Source = null;
           string a = s;
            MemoryStream stream = null;
            TagLib.File file = TagLib.File.Create(a); //FilePath is the audio file location

            if (file.Tag.Pictures.Length >= 1)
            {
                TagLib.IPicture pic = file.Tag.Pictures[0];  //pic contains data for image.
                stream = new MemoryStream(pic.Data.Data);//create an in memory stream

                bmp = BitmapFrame.Create(stream);
                img.Source = bmp;


            }

推荐答案


这篇关于WPF-带有图像的列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 21:19