10

The icons in the ListView in C# are very small by default (probably 16x16px). How can I increase the size of these icons?

I tried making the source images in the ImageList larger, and also tried using the LargeImageList property, but to no avail.

I'm using C#, WinForms and .net 4.0.

Shiroy
  • 1,648
  • 1
  • 15
  • 22
  • I'm guessing you're using WinForm? What .Net version? – Gabriel GM May 04 '15 at 17:10
  • Yes. WinForms and .net version 4.0 – Shiroy May 04 '15 at 17:10
  • A great answer here: http://stackoverflow.com/questions/1101149/displaying-thumbnail-icons-128x128-pixels-or-larger-in-a-grid-in-listview?rq=1 – Shiroy May 04 '15 at 17:30
  • 3
    You can set the ImageList.ImageSize to anything up to 256x256. Also look at the ColorDepth!! BTW: The height will determine the ListViewItemHeight – TaW May 04 '15 at 18:23

2 Answers2

27

The trick is in modifying the ImageSize propertiy of the ImageList (who would've thought)?

        listView1.View = View.LargeIcon;

        ImageList iList = new ImageList();
        iList.ImageSize = new Size(64, 64);  
        iList.ColorDepth = ColorDepth.Depth32Bit;

        listView1.LargeImageList = iList;

As a bonus, remember to set the View property of the ListView to be LargeIcon and also increase the ColorDepth (if you so desire).

Shiroy
  • 1,648
  • 1
  • 15
  • 22
  • 2
    _remember to set the View property of the ListView_ Well, that would depend on what he __wants__. Any mode will work! – TaW May 04 '15 at 18:25
-1

Use the LargeImageList property:

https://msdn.microsoft.com/en-us/library/system.windows.forms.listview.largeimagelist%28v=vs.110%29.aspx

Steve Wellens
  • 20,506
  • 2
  • 28
  • 69
  • 1
    Yes, but it still doesn't make the images bigger. You need to define a larger size image in the ImageList as well – Shiroy May 04 '15 at 17:24
  • @ShiroyChoksey - I didn't say it would make the images bigger. But you need to set that property if you want large images to show up. – Steve Wellens May 06 '15 at 04:18