listview 可分類
Group_pi=listView1.Groups.Add(new ListViewGroup(title, HorizontalAlignment.Left));
//然後
ListViewItem lvi = new ListViewItem();
int pi = listView1.Items.Count;
//加圖
if (add_image)
{
string img_name=Dir_item.FullName+"\\cover.jpg";
if (File.Exists(img_name))
{
imageList1.Images.Add(Image.FromFile(img_name));
}
else
imageList1.Images.Add(Image.FromFile(Application.StartupPath + "\\F404.jpg"));//找不到
lvi.ImageIndex = pi;
}
lvi.Text = Dir_item.Name;
lvi.ToolTipText = Dir_item.FullName;
lvi.Group = listView1.Groups[Group_pi]; //看分盜那一類
listView1.Items.Add(lvi);
//然後
ListViewItem lvi = new ListViewItem();
int pi = listView1.Items.Count;
//加圖
if (add_image)
{
string img_name=Dir_item.FullName+"\\cover.jpg";
if (File.Exists(img_name))
{
imageList1.Images.Add(Image.FromFile(img_name));
}
else
imageList1.Images.Add(Image.FromFile(Application.StartupPath + "\\F404.jpg"));//找不到
lvi.ImageIndex = pi;
}
lvi.Text = Dir_item.Name;
lvi.ToolTipText = Dir_item.FullName;
lvi.Group = listView1.Groups[Group_pi]; //看分盜那一類
listView1.Items.Add(lvi);
留言
張貼留言