Constantine
Constantine

Reputation: 21

How to display images larger than 256x256 in ListView?

ListView is connected to ImageList in order to display images. The maximum size of image in ImageList is 256x256.

I tried to add larger image in ImageList, but an exception occurs. On the following line:

imageList.ImageSize = new Size(300, 300);

"Value of '300' is not valid for 'ImageSize.Width'. 'ImageSize.Width' should be between 1 and 256.\r\nParameter name: ImageSize"

Is there a way to display larger images in ListView? For example 512x512 or bigger?

Upvotes: 2

Views: 527

Answers (1)

xpda
xpda

Reputation: 15813

With DPI Awareness, you can use images larger than 256 in higher Windows resolutions. For example, with 150% Windows scale settings (Settings, Scale and Layout), the ImageList.Size limit is 256 * 1.5 or 384. At 250%, the limit is 256 * 2.5. At 100% scale the limit is 256.

The display resolution might have some influence. I haven't found any of this in documentation.

Upvotes: 0

Related Questions