在选择事件后一个TreeView,我填充图像列表视图。
我想自定义格式这些图像,并把黑色边框的每个图像周围。
private void TreeView1_Select(object sender, EventArgs e) {
if (folder != null && System.IO.Directory.Exists(folder)) {
DirectoryInfo dir = new DirectoryInfo(@folder);
foreach (FileInfo file in dir.GetFiles()) {
try {
imageList.Images.Add(Image.FromFile(file.FullName));
} catch {
Console.WriteLine("This is not an image file");
}
}
for (int j = 0; j < imageList.Images.Count; j++) {
this.ListView1.Items.Add("Item" + j);
this.ListView1.Items[j].ImageIndex = j;
}
this.ListView1.View = View.LargeIcon;
this.ListView1.LargeImageList = imageList;
this.ListView1.DrawItem +=
new DrawListViewItemEventHandler(ListView1_DrawItem);
}
}
private void ListView1_DrawItem(object sender, DrawListViewItemEventArgs e)
{
}