Results 1 to 4 of 4

Thread: imagelist_drawex

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Location
    Oak Park, IL, USA
    Posts
    43

    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

  2. #2
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    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.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 1999
    Location
    Oak Park, IL, USA
    Posts
    43

    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

  4. #4
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    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
  •  



Click Here to Expand Forum to Full Width