开发者

Changing filename color in Windows Explorer list view.

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜