开发者

Changing filename color in Windows Explorer list view.

开发者 https://www.devze.com 2023-03-01 17:43 出处:网络
I would like to customize Windows Explorer. One thing I want to do is changing file name\'s color in list view if the file has a special condition.

I would like to customize Windows Explorer.

One thing I want to do is changing file name's color in list view if the file has a special condition.

Is it possible by window subclassing? or does it need api hooking?

Please let me know what is the best way to do this.开发者_StackOverflow社区

Thanks.


Yes, you can do it with the window subclassing:

Add NM_CUSTOMDRAW handler to your CListCtrl-derived class

void CMyList::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{

LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;

switch (lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
    *pResult = CDRF_NOTIFYITEMDRAW;
    break;

case CDDS_ITEMPREPAINT:
    *pResult = CDRF_NOTIFYSUBITEMDRAW;
    break;

case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
    lplvcd->clrText = **MY_COLOR**;
    *pResult = CDRF_DODEFAULT;
}

}

0

精彩评论

暂无评论...
验证码 换一张
取 消