示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            seImageListView1.AllowMultiSelection = true;

            _getImage =
                new ImageListViewItem.GetImageHandler((key) => {
                return(Image.FromFile(key.ToString()));
            });


            DirectoryInfo path = new DirectoryInfo(@"D:\Users\sheng\Pictures");

            foreach (FileInfo p in path.GetFiles("*.*"))
            {
                if (p.Name.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".ico", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".cur", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".emf", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".wmf", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".tif", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".tiff", StringComparison.OrdinalIgnoreCase) ||
                    p.Name.EndsWith(".gif", StringComparison.OrdinalIgnoreCase))
                {
                    seImageListView1.Items.Add(new ImageListViewItem(p.FullName, p.Name, _getImage));
                }
            }


            //for (int i = 0; i < 300; i++)
            //{
            //    seImageListView1.Items.Add(new ImageListViewItem());
            //}
        }
 public ImageListViewController(ImageListView imageListView)
 {
     _imageListView                     = imageListView;
     _imageListView.AllowDrop           = false;
     _imageListView.AllowMultiSelection = true;
     _getImage = new ImageListViewItem.GetImageHandler((key) =>
     {
         ImageResourceInfo resourceInfo = (ImageResourceInfo)key;
         return(resourceInfo.GetImage());
     });
 }