그래서 이미지 파일 경로 목록을 기반으로 1000 개의 미리보기 이미지를 채울 수 있기를 원합니다. 다음 코드를 사용하여 시도했지만 200 + 이미지 후 내 프로그램 "System.Drawing.dll에서 발생한 'System.OutOfMemoryException'형식의 첫 번째 기회 예외가 throw됩니다 깨달았다. 필요에 따라 listview에서 미리보기 이미지를로드하는 방법은 무엇입니까?
private void PopulateThumbnails(List<string> queryResults)
{
this.playerListView.Items.Clear();
this.imageList1.Images.Clear();
ImageViewer imageViewer = new ImageViewer();
foreach (string file in queryResults)
{
try
this.imageList1.Images.Add(Image.FromFile(file));
catch
Console.WriteLine("This is not an image file");
}
this.ListView.View = View.LargeIcon;
this.imageList1.ImageSize = new Size(256, 144);
this.ListView.LargeImageList = this.imageList1;
for (int j = 0; j < this.imageList1.Images.Count; j++)
{
ListViewItem item = new ListViewItem();
item.ImageIndex = j;
this.ListView.Items.Add(item);
}
}
는 내가 아마 단지 ... 필요에 따라 썸네일을 채우는해야하지만 실현 가) 어떻게 목록보기에로드되는 항목의 수를 알 수 있습니까? b) listview에서 스크롤 이벤트를 검색하려면 어떻게해야합니까?
ListViewItem에 썸네일이나 이미지를 추가하는 방법에 대한 Google 검색은 이전의' 그럼'그 사이에 게시 http://stackoverflow.com/questions/17151776/c-sharp-listview-adding-item-with-image-and-text-and-align-the-text-to-left – MethodMan
잘 내 문제는 미리보기 이미지를 추가하는 방법을 알지 못합니다. 있는 그대로 작동합니다. 너무 많은 썸네일을 추가하면 문제가 발생합니다. – JLYK
어쩌면 코드를 디버깅하는 방법에 대해 잘 모르는 뭔가가있을 수 있습니다. ListView에 항목을 추가 한 후에이 줄에서 항목을 해제해야 할 수도 있습니다.Items'ListViewItem item = new ListViewItem();'그러나 코드를 통해 단계를 밟으면 뭔가 발견 할 수 있다고 생각합니다. – MethodMan