What's new

Listview

linker

Emutalk Member
Hello. I know thats not a big deal, but why the heck isn't the image in the column info transperent. It is transperent in the list view messages, but not in the header. Source code:

Code:
		//set the image lists
		if (himlSmall = ImageList_Create(16, 16, ILC_COLORDDB | ILC_MASK, 4, 0))
		{
			HICON hIcon;

			hIcon = LoadImage(DVhInst, MAKEINTRESOURCE(IDI_DVQUESTIONMARK), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
			ImageList_AddIcon(himlSmall, hIcon);
			ListView_SetImageList(hwndDebugList, himlSmall, LVSIL_SMALL);
		}

I've also tried changing LR_DEFAULTCOLOR to LR_COPYFROMRESOURCE and LR_LOADTRANSPARENT.. no effect.
 
OP
linker

linker

Emutalk Member
MooCowSheep said:
Try using "if (himlSmall == ImageList_Create(16, 16, ILC_COLORDDB | ILC_MASK, 4, 0))". See if that helps.

OH WOW! That IS the correct sollution!

Please reply only if you know how to fix that.
 

icepir8

Moderator
hImgList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK, 12, 0);
 
OP
linker

linker

Emutalk Member
icepir8 said:
hImgList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK, 12, 0);

Thanx for the solution icepir8... but still the same effect - transperent in the messages, white in the header. I noticed that there is the same issue in winrar3 but not in flashget.
 

tooie

New member
m_hImageList = ImageList_Create(BitMapWidth,BitMapHeight,ILC_COLOR | ILC_MASK, 40, 40);
hBmp = LoadBitmap(DllhInst,MAKEINTRESOURCE(IDB_TASKLIST_BITMAP));
ImageList_AddMasked(m_hImageList,hBmp, RGB(255,0,255));
DeleteObject(hBmp);

I guess your mask would be white so RGB(255,255,255))
 

tooie

New member
I am not sure that icon's have a mask color, so you would have to change the image to a bitmap
 

Cyberman

Moderator
Moderator
Oh something I've had fun with before.. Ok there are a few things to remember. First off you need a LIST of images to use for the icons. I can show you it in BCB but you are using VC++ (which is a bit more confusing to me since the API is completely different).

However what you do is fairly much the same. To draw something transparency you have to be sure your image list is set with MASKS. Then DRAW the image into the Rect area passed during the draw event. VCL in BCB handles most of this for you, I'm not sure of the details you would encounter in VC.net.

In BCB you can add bitmaps to a list with the mask by specifying the color, I'm not sure how you would do that in VC.net off hand, I have the learning version of it.

Anyhow you invert the mask and AND it with the rectangle then AND the bitmap with the mask and OR the resulting bitmap with the Rectangle.

In other words you do this:

PixelDS = (!PixelMB & PixelDS) | (PixelMB & PixelBM);
You end up 'cutting' a shape out of the image that you 'or' with a bitmap with the transparent color set zero.

This is borrowed from Jenova' Qhimms VC based FF7 editor:

This constructs an image list from a bitmap.

Code:
//	CImageList *il;
	CBitmap bmp;
	bmp.LoadBitmap(IDB_MATERIA);
//	il = new CImageList();
	il.Create(14,12,ILC_COLOR16 | ILC_MASK,0,10);
	il.Add(&bmp,RGB(0,255,255));
	bmp.DeleteObject();
	m_MateriaList.SetImageList(&il,TVSIL_NORMAL);

He however did not do anything fancy to the list to show ICON's in it (hmm) so I have to assume that this is supported by MS (grin) and the Item object has a ImageIndex value that needs to be set as wel.

Cyb
 

Top