.Net Windows Forms ListView OwnerDraw Account LargeImageList

I own .Net Windows Forms ListView and I see a very strange error / behavior when I need to draw an image from the associated LargeImageList.

When the View type is a type that uses a LargeImageList (Tile, LargeIcon, etc.), I draw element images from the LargeImageList. In this state, I see a huge increase in memory, and when you try to scroll through the ListView, it becomes more obvious, since you see a disgusting scroll. The same does not happen when the same code uses a SmallImageList, which looks something like this:

Image MyImage = this.LargeImageList.Images[MyIndex];
e.Graphics.DrawImage(MyImage,MyLocation);

It reproduces in XP and 7 according to my tests. Is this a known bug, in any workaround?

Hello,

Özden

+3
source share
2 answers

Although I still think this is a mistake, I found a workaround. If you draw with ImageList.Draw instead of e.Graphics.DrawImage , this problem seems to go away.

+3
source

How do you manage an invalid drawing area? As you say, it looks like you are “dragging” a control, I mean drawing, even if it is not needed.

+1
source

Source: https://habr.com/ru/post/1723017/


All Articles