Transparent images in ImageLists for ListViews

前端 未结 2 496
北海茫月
北海茫月 2021-01-07 07:40

Here is a picture of my program:

\"WhiteFlag\"

As you can see, the icons a

2条回答
  •  忘掉有多难
    2021-01-07 08:09

    I found a bit of a hack around this problem. If you set the background image to a blank white bitmap using ListView_SetBkImage it will force the icons to draw transparently. Unfortunately, doing this causes NM_CUSTOMDRAW to ignore the background color set with CDRF_NEWFONT. To get around it, call FillRect to fill background of the item in CDDS_ITEMPREPAINT and return CDRF_DODEFAULT or CDRF_NEWFONT if you are changing the foreground color as well.

提交回复
热议问题