请问如何将从数据库中读取图片后的ImageList中的图片显示到Listview上(只要图片,不要文本)
或者怎么将数据库中的图片直接显示到Listview上。

解决方案 »

  1.   

    to 请问如何将从数据库中读取图片后的ImageList中的图片显示到Listview上(只要图片,不要文本)
    或者怎么将数据库中的图片直接显示到Listview上。Solution as follows:
    1.Read bytes from DB;
    2.Create image using bytes;
    3.Add image into imagelist;
    4.Add listviewitem with imageindex into listview.
      

  2.   

    Sample code for "2.Create image using bytes;"byte[] bData;//From DB
    MemoryStream ms = new MemoryStream( bData, true );
    ms.Read( bData, 0, bData.Length );
    Bitmap bit = new Bitmap( ms );
    ms.Close();
      

  3.   

    to Knight94(愚翁) 大哥
    我现在迷惑的就是用什么方法将MemoryStream 插入到listviewItem中去。
      

  4.   

    to  Knight94(愚翁)  大哥
    我现在就是不知道怎么实现第4步。具体用什么属性或者什么方法,请告知,谢谢
      

  5.   

    to 我现在就是不知道怎么实现第4步。具体用什么属性或者什么方法,请告知,谢谢如果前三步已经做了,第四步很简单。ListViewItem itmNew = yourListView.Items.Add( "NewAdd" );
    itmNew.ImageIndex = 1;by the way,
    you should set imagelist property to your listview as followsyourListView.LargeImageList = yourImageList;
      

  6.   

    哈哈
    感谢Knight94(愚翁) 大哥的帮助。