Quote Originally Posted by Beginner_MFC View Post
class IEHeaderCtrl : public CHeaderCtrl { // Construction public: IEHeaderCtrl(); // Generated message map functions protected: afx_msg virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
DECLARE_MESSAGE_MAP()
}

Code for IEHeaderCtrl.cpp

BEGIN_MESSAGE_MAP(IEHeaderCtrl, CHeaderCtrl)
END_MESSAGE_MAP

void IEHeaderCtrl::
DawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { HDITEM hdi; CBrush brush(RGB(255, 0, 0)); CString csBuffer; CRect rectFrame(lpDrawItemStruct->rcItem); ZeroMemory(&hdi, sizeof(HDITEM)); hdi.mask = HDI_TEXT; LPTSTR pBuf = csBuffer.GetBufferSetLength(MAX_PATH); hdi.mask = HDI_TEXT; hdi.pszText = pBuf; hdi.cchTextMax = MAX_PATH; GetItem(lpDrawItemStruct->itemID, &hdi); csBuffer.ReleaseBuffer(); CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC); pDC->FillRect(rectFrame, &brush); pDC->SetTextColor(RGB(255, 255, 255)); pDC->SetBkMode(TRANSPARENT); pDC->DrawText(csBuffer, &lpDrawItemStruct->rcItem, DT_LEFT | DT_SINGLELINE | DT_VCENTER); brush.Detach();
}

/*code for Myformview.cpp where my listctrl is embedded:*/

void MyFormView :: OnInitiUpdate()
{
IEHeaderCtrl m_HeaderCtrl;
CHeaderCtrl* pHeader = NULL; pHeader=m_List.GetHeaderCtrl(); VERIFY(m_HeaderCtrl.SubclassWindow(pHeader->m_hWnd)); HDITEM hdItem; hdItem.mask = HDI_FORMAT;
}
Can you read what you have posted?
I can't.

Please, post good readable, formatted code snippet. Use Code tags.