|
-
Aug 22nd, 2001, 02:28 PM
#1
Thread Starter
Member
imagelist_drawex
I am using ImageList_DrawEx to draw an icon from an ImageList control onto a DC that I have. I need to draw the icon, not the whole 16x16, so I figured using the constant they have for style, ILD_TRANSPARENT, would do it. It isnt, doing it. I use a fillrect to fill in the background color i want on the DC (a .hDC from a DrawItemStruct passed in on the WM_DRAWITEM message of a menu) , then i need to draw the icon. Im getting a 16x16 gray square wit hthe icon in the center of it. It isnt using the mask color, or only drawing the thing. Im no master of the drawing api's so does anyone have any idea how to figure out the mask color, and use it to do this correctly?
Possibly CreateCompatibleDC() then draw it on there. After that copy it to the DC that I need it on using the mask?
Gregg
-
Aug 22nd, 2001, 06:29 PM
#2
Frenzied Member
I cheated a little when I did my menu pics. I first copy the image from the ImageList to a 16X16 PictreBox using the .Draw method. The PictureBox already had the proper background color. I then BitBlt the whole picturebox on to a DC I create. The DC now has the icon with the correct background color, and it shows up on the menu fine.
picIcon.Cls
imgTool.ListImages(1).Draw picIcon.hDC, 0, 0, imlTransparent
picIcon.Refresh
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Aug 22nd, 2001, 07:29 PM
#3
Thread Starter
Member
problem
problem with that is. that im doing this inside an activex control, so i have to use the ImageList_DrawEx funciton, or the ImageList_GetIcon function.
Gregg
-
Aug 22nd, 2001, 07:40 PM
#4
Frenzied Member
Ah, well then, ...never mind.
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|