상세.
코드예.
/*
My dialog class contains a CTreeCtrl member that uses the resource ID IDC_TEST_DEF_TREE.
The method OnNMCustomdraw sets the color of the selected item.
The message handler is registered in the message map like this:
*/
ON_NOTIFY(NM_CUSTOMDRAW, IDC_TEST_DEF_TREE, OnNMCustomdraw)
void CSelectTestDefinitionDlg::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVCUSTOMDRAW lpLVCustomDraw = reinterpret_cast<LPNMLVCUSTOMDRAW>(pNMHDR);
switch (lpLVCustomDraw->nmcd.dwDrawStage)
{
case CDDS_ITEMPREPAINT:
case CDDS_SUBITEM:
if (lpLVCustomDraw->nmcd.uItemState & CDIS_SELECTED)
{
// Your color definitions here:
lpLVCustomDraw->clrText = RGB(255, 255, 255);
lpLVCustomDraw->clrTextBk = RGB(0, 70, 60);
}
break;
default:
break;
}
*pResult = 0;
*pResult |= CDRF_NOTIFYPOSTPAINT;
*pResult |= CDRF_NOTIFYITEMDRAW;
*pResult |= CDRF_NOTIFYSUBITEMDRAW;
}
from
'VisualStudio.C++.C# > 코딩팁,함수활용,단편' 카테고리의 다른 글
C#. WebSocketSharp. 웹소켓 라이브러리. (3) | 2020.12.26 |
---|---|
MFC. 대화상자에 분할 윈도우 구현. (0) | 2020.12.05 |
SetWindowTheme. (0) | 2020.11.19 |
MFC. CHeaderCtrl. (0) | 2020.11.18 |
MFC. Tree Control with Columns. (0) | 2020.11.17 |
댓글