帮助!如何获取clistctrl中行的当前背景色? [英] Help! How do you get the current background color of a row in a clistctrl?
本文介绍了帮助!如何获取clistctrl中行的当前背景色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从下面的代码片段中可以看到,我可以使用自定义绘制设置clistctrl的任何行的颜色,而不会出现任何问题,但是我无法获得行的当前颜色.它只是返回垃圾.同样由于某种原因,CMFCListCtrl的其他成员似乎都没有.谁能告诉我我在做什么错.
As you can see from the code snippet below I can set the color of any row of a clistctrl using custom draw without any problem but I cannot get the current color of a row. It just returns rubbish. Also for some reason none of the other members of CMFCListCtrl seem to be there. Can anybody please tell me what I am doing wrong.
void CDDListCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
{
NMLVCUSTOMDRAW* cd = reinterpret_cast<nmlvcustomdraw*>(pNMHDR);
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == cd->nmcd.dwDrawStage )
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == cd->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == cd->nmcd.dwDrawStage )
{
if (cd->nmcd.hdr.idFrom == IDC_PLAYLIST)
{
if (PlaylistInfo.m_AddDataType == ADD_TYPE_NORMAL)
{
if ((RegValue == SINGLE_MANUAL) || (RegValue == SINGLE_RANDOM) || (RegValue == SINGLE_FORMAT))
{
cd->clrTextBk = RED;
}
else
{
cd->clrTextBk = GREEN;
}
}
}
if (PlaylistInfo.m_AddDataType == ADD_TYPE_SEGUE)
{
if ( 1 == cd->iSubItem )
{
cd->clrTextBk = GetTextBkColor();
SetTextBkColor(cd->clrTextBk);
推荐答案
不要只是不想在CDRF_SKIPDEFAULT
时不返回CDRF_SKIPDEFAULT
>?
Don''t you just want to NOT returnCDRF_SKIPDEFAULT
when it''sADD_TYPE_SEGUE
?
这篇关于帮助!如何获取clistctrl中行的当前背景色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文