public static void ShowButtons(ListView.ListViewItemCollection items, string disableButtonWithThisTooltip) { List <string> tooltips = items.OfType <ListViewItem>().Select(i => i.Text).ToList(); List <Image> images = items.OfType <ListViewItem>().Select(item => item.ImageList.Images[item.ImageKey]).ToList(); List <Icon> icons = images.Select(img => Icon.FromHandle(((Bitmap)img).GetHicon())).ToList(); ShowButtons(tooltips, icons, disableButtonWithThisTooltip); }
private static IEnumerable <ListViewItem> GetAllItemsFrom(ListView.ListViewItemCollection c) { foreach (var item in c.OfType <ListViewItem>()) { yield return(item); } }