Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# ListView image icon size

Tags:

c#

.net

winforms

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.

like image 811
Shiroy Avatar asked May 04 '15 17:05

Shiroy


1 Answers

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).

like image 194
Shiroy Avatar answered Oct 19 '22 11:10

Shiroy