private async void RetrieveThumbnailByIndex(Int32 index) {
await Task.Run(() => {
if (this.IsCancelRequested) return;
//F.Application.DoEvents();
var itemBounds = new User32.RECT();
var lvi = new LVITEMINDEX() { iItem = index, iGroup = this.GetGroupIndex(index) };
User32.SendMessage(this.LVHandle, MSG.LVM_GETITEMINDEXRECT, ref lvi, ref itemBounds);
var r = new Rectangle(itemBounds.Left, itemBounds.Top, itemBounds.Right - itemBounds.Left, itemBounds.Bottom - itemBounds.Top);
if (r.IntersectsWith(this.ClientRectangle)) {
var sho = Items[index];
var icon = sho.GetHBitmap(IconSize, true, true);
sho.IsThumbnailLoaded = true;
sho.IsNeedRefreshing = false;
if (icon != IntPtr.Zero) {
Int32 width = 0, height = 0;
Gdi32.ConvertPixelByPixel(icon, out width, out height);
sho.IsOnlyLowQuality = (width > height && width != IconSize) || (width < height && height != IconSize) || (width == height && width != IconSize);
Gdi32.DeleteObject(icon);
this.RedrawItem(index);
}
}
});
}