想用listview来显示图片。效果:
--------------------------------------------
|         |          |          |          |
|   IMG   |   IMG    |    IMG   |    IMG   |
|         |          |          |          |
|------------------------------------------|
|         |          |          |          |
|   IMG   |   IMG    |    IMG   |    IMG   |
|         |          |          |          |
|------------------------------------------|每行显示四个图片。如何实现?

解决方案 »

  1.   

    参考:
    http://topic.csdn.net/u/20100107/11/a123787a-4fe8-484d-b25e-3e9c39f68e90.html
    http://topic.csdn.net/u/20100107/17/8429e75f-0e60-4e1e-a643-2e8609a9bc60.html
      

  2.   

     设置显示模式 large 还是 small 
      

  3.   

    this.listView1.Items[i].ImageIndex  =1 ListViewItem item = new ListViewItem("1"); 
    Image image = ConvertToImage(""); 
    imageList1.Images.Add(image); 
    item.ImageIndex = 1; 
    listView1.Items.Add(item); 
    item.SubItems.Add(""); 
    item.SubItems.Add(""); 
    public static byte[] ConvertToBytes(string fileName) { 
                Image image = Image.FromFile(fileName); 
                BinaryFormatter bf = new BinaryFormatter(); 
                MemoryStream ms = new MemoryStream(); 
                bf.Serialize(ms, image); 
                byte[] result = new byte[ms.Length]; 
                ms.Position = 0; 
                ms.Read(result, 0, result.Length); 
                ms.Close(); 
                return result; 
            } 
      

  4.   

    设置显示模式 large 还是 small