I am searching for codeexamples for a listview with Images.
I found many topicc, how to add an image to the first item in a listview. Also i found information how to add an Image to a subitem in a listview.
Now i wonder how to add Images with different size to a listview?

I use the method with the ImageList:
fn ImageList_Create, 68, 96, ILC_COLOR24 ,NULL, 256

there you can define the same size for all images...
Posted on 2008-10-14 11:02:42 by diablo2oo2
I'm pretty sure you have to use 'Owner Drawing' to achieve what you want.
This will give you total control of drawing the content of every cell.
You should be able to find examples of owner-drawn listview here on this forum, search :)
Posted on 2008-10-14 22:08:34 by Homer
Hi diablo

Have you try my old example
http://www.asmcommunity.net/board/index.php?topic=25820.0

This only with icons ,i think if you add oder images must u few modified in this code

greets,
ragdog
Posted on 2008-10-18 12:15:39 by ragdog

Hi diablo

Have you try my old example
http://www.asmcommunity.net/board/index.php?topic=25820.0

This only with icons ,i think if you add oder images must u few modified in this code

Yes, i currently use your code. And it works fine with icons. But it doesnt help me to solve the problem i described above.
Posted on 2008-10-20 14:29:54 by diablo2oo2
He wants to use images of arbitrary size.
That means he wants arbitrary column and row sizes!

There are three levels of control you can use for manipulating the drawing of listviews.

#1 is Custom-Drawing, which lets you control the drawing of cell content, but not the size of cell rectangles, or even allow you to paint subitems.
I don't think this is what you want.

#2 is Owner-Drawing, which gives you the ability to paint subitems, but again I think you are stuck with a regular cell layout. Again I'm pretty sure you can't use this.

#3 is to trap WM_PAINT, and do ALL of the drawing yourself.
Most people don't touch this one.
This is hard because you need to know where and how big all the cells will be BEFORE you paint them, and I think its the only way you're going to be able to do what you are describing.
Now you'll have to paint not only the cell content, but also the cell BORDERS, in the context of the current scrolled content, it's almost not worth having a listview at all in this case since you are effectively implementing listview yourself, you're really writing your own custom control from scratch.



Posted on 2008-10-21 00:21:51 by Homer
There might be another direction to look into. Take thumbnails of your images at a specific size. and when user selects the listview item you draw the larger image in another control perhaps.

Grincheux was working on something similar: http://www.masm32.com/board/index.php?topic=9964.msg73286#msg73286 and uses a third party dll to generate the thumbnail view of the different image sizes - as they are all reduced/scaled to a defined size for use in an imagelist linked to the listview.
Posted on 2008-10-21 03:44:21 by keithsrobertson
Hi diablo

Here is a snipped code and example for images in a combobox
I think this is relativ easier to convert for listview


;si aucun masque le comportement du controle et les couleurs deviennent imprévisible
invoke ImageList_Create,120,120,ILC_COLOR8 or ILC_MASK ,1,1 ;avec masque a créer
mov Himage,eax
BOUCLEFOR 1 ;charger les bitmaps
mov edx,500
add edx,cpt
invoke LoadBitmap,hInstance,edx
mov Hbitmap,eax
.if eax == 0
invoke MessageBox,NULL,SADD("LoadBitmap failed"),SADD("quitte"),MB_OK
RET
.endif
; si l'image a déja un masque
;invoke ImageList_Add,Himage,Hbitmap,NULL
;si l'image n'a pas de masque il faut en générer un
xor edx,edx
mov edx,RGB
;ajoute l'image a la liste d'image et crée son masque
invoke ImageList_AddMasked,Himage,Hbitmap,edx         
invoke DeleteObject,Hbitmap
NEXTFORUNTIL 7,1
;attacher l'image liste a la combo
invoke SendMessage,Hcombo, CBEM_SETIMAGELIST,0,Himage


Greets
Posted on 2008-10-23 13:29:21 by ragdog
I cannot really see what you are saying happening, as when you create the imagelist you obviously define an imagelist size. From what I know a listview can only have one imagelist as well, so the images in the listview will therefore all be the same size.
Posted on 2008-10-24 17:15:35 by Unknown
One solution would be to choose a large size for your imagelist size, and simply have some images with a lot of empty space around them.
Posted on 2008-10-24 23:04:06 by Homer
as sharp as a razor
Posted on 2008-10-28 22:11:18 by dapro