如何改变ListControl报表形式中的Column的文字颜色和背景颜色
若以下回答无法解决问题,邀请你更新回答
1个回答
展开全部
1.afx_msg void OnCustomdrawList(NMHDR*, LRESULT*);
2.ON_NOTIFY_REFLECT ( NM_CUSTOMDRAW, OnCustomdrawList )
3.void CEditListCtrl::OnCustomdrawList( NMHDR* pNMHDR, LRESULT* pResult )
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
*pResult = 0;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
{
int nItem=(int)(pLVCD->nmcd.dwItemSpec);
if(nItem==m_nItem){
// pLVCD->clrText = RGB(255,155,255);
pLVCD->clrTextBk = RGB(255,0,0);
}
*pResult = CDRF_DODEFAULT;
}
}
2.ON_NOTIFY_REFLECT ( NM_CUSTOMDRAW, OnCustomdrawList )
3.void CEditListCtrl::OnCustomdrawList( NMHDR* pNMHDR, LRESULT* pResult )
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
*pResult = 0;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
{
int nItem=(int)(pLVCD->nmcd.dwItemSpec);
if(nItem==m_nItem){
// pLVCD->clrText = RGB(255,155,255);
pLVCD->clrTextBk = RGB(255,0,0);
}
*pResult = CDRF_DODEFAULT;
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询