没有图像列表的列表视图?
我再次遇到了一个我似乎无法找到解决方案的问题。所以在这里,我有一个显示图像文件目录的ListView,我希望列表视图显示这些文件的这些图像,问题是我还需要程序在每个像素级别修改图像,所以我在单独的线程上完成此操作,所以我想要做的是获取已修改图像的现有 PictureBox 列表,并将文件名称与相应的图像进行匹配。关于如何做到这一点有什么想法吗?
这是我到目前为止所拥有的
public static List<PictureBox> ContentItems = new List<PictureBox>();
...
public static string ContentDirectory = "";
private void FileTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
TreeNode newSelected = e.Node;
FileList.Items.Clear();
DirectoryInfo nodeDirInfo = (DirectoryInfo)newSelected.Tag;
ListViewItem.ListViewSubItem[] subItems;
ListViewItem item = null;
foreach (FileInfo file in nodeDirInfo.GetFiles())
{
item = new ListViewItem(file.Name);
subItems = new ListViewItem.ListViewSubItem[]
{ new ListViewItem.ListViewSubItem(item, "File"),
new ListViewItem.ListViewSubItem(item,
file.LastAccessTime.ToShortDateString())};
item.SubItems.AddRange(subItems);
FileList.Items.Add(item);
}
FileList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
}
once again i have a problem that i can't quite seem to come up with a solution to. so here it is, I have a ListView displaying the directories of Image files,i want the listview to display these images for these files, the problem is I also need the images to be modified by the program at a per-pixel level so i have this done on a separate thread, so what i want to do is take my already existing PictureBox list of the modified Images and match up the names of the files with the corresponding image. Any ideas on how to do this?
here is what i have so far
public static List<PictureBox> ContentItems = new List<PictureBox>();
...
public static string ContentDirectory = "";
private void FileTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
TreeNode newSelected = e.Node;
FileList.Items.Clear();
DirectoryInfo nodeDirInfo = (DirectoryInfo)newSelected.Tag;
ListViewItem.ListViewSubItem[] subItems;
ListViewItem item = null;
foreach (FileInfo file in nodeDirInfo.GetFiles())
{
item = new ListViewItem(file.Name);
subItems = new ListViewItem.ListViewSubItem[]
{ new ListViewItem.ListViewSubItem(item, "File"),
new ListViewItem.ListViewSubItem(item,
file.LastAccessTime.ToShortDateString())};
item.SubItems.AddRange(subItems);
FileList.Items.Add(item);
}
FileList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
毕竟,我确实必须使用图像列表,这是我如何让它工作的:
I Did have to use an image list after all Heres how i got it to work: