01.
private
void
addImage(
object
sender, EventArgs e)
02.
{
03.
ImageList imageList =
new
ImageList();
04.
imageList.ImageSize =
new
Size(100, 80);
05.
imageList.ColorDepth = ColorDepth.Depth32Bit;
06.
07.
int
i = 0;
08.
string
[] files = openFile.FileNames;
09.
string
[] pathes =
new
string
[files.Length];
10.
11.
foreach
(
string
file
in
files)
12.
{
13.
pathes[i] = file;
14.
i++;
15.
}
16.
17.
foreach
(
string
path
in
pathes)
18.
{
19.
imageList.Images.Add(Bitmap.FromFile(path));
20.
FileInfo fileInfo =
new
FileInfo(path);
21.
String strDir = fileInfo.Name;
22.
listView1.Items.Add(strDir);
23.
listView1.TileSize =
new
System.Drawing.Size(100, 80);
24.
25.
}
26.
for
(
int
j = 0; j < pathes.Length; j++)
27.
{
28.
this
.listView1.Items[j].ImageIndex = j;
29.
}
30.
this
.listView1.View = View.LargeIcon;
31.
this
.listView1.LargeImageList = imageList;
32.
}