CListCtrl
-
in OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) event of CListCtrl
void CMyList::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLVCUSTOMDRAW pLVCD reinterpret_cast(pNMHDR);
switch(pLVCD->nmcd.dwDrawStage)
{
case CDDS_ITEMPREPAINT:
if(pLVCD->nmcd.dwItemSpec == 1) // if it is specified row
{
pLVCD->clrTextBk = RGB(235,235,235);
// and doing other
}
break;
}
}Zo.Naderi-Iran
-
in OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) event of CListCtrl
void CMyList::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLVCUSTOMDRAW pLVCD reinterpret_cast(pNMHDR);
switch(pLVCD->nmcd.dwDrawStage)
{
case CDDS_ITEMPREPAINT:
if(pLVCD->nmcd.dwItemSpec == 1) // if it is specified row
{
pLVCD->clrTextBk = RGB(235,235,235);
// and doing other
}
break;
}
}Zo.Naderi-Iran
-
Hi, Modify the code zon_cpp gave you and use something like this in the CDDS_ITEMPREPAINT case:
HFONT hOldFont = (HFONT)SelectObject(pLVCD>hdc, m_Font);
// Draw your text... you can get the row/column text using GetItemText()
// You can get the row# using pLVCD->nmcd.dwItemSpec
// And get the column# using pLVCD->iSubItem
// You can tell the CListCtrl *not* to draw over what you just did by setting *pResult = CDRF_SKIPDEFAULT;
SelectObject(pLVCD>hdc, hOldFont);In your header add:
CFont m_Font;
In your dialog constructor add something like:
m_Font.CreateFont(13,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,DEFAULT_PITCH | FF_DONTCARE,_T("MS Shell Dlg 2"));
Best Wishes, -David Delaune
-
Inherit from CGridListCtrlEx - Grid Control Based on CListCtrl[^] and override CGridListCtrlEx::OnDisplayRowFont()