Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,,,
Im trying to change the colour of list contols header,text and background colour while using draw item function I'm getting error C2065: 'GetItem' : undeclared identifier , this error occurs here:
GetItem(lpDrawItemStruct->itemID, &hdi);  

please say how to rectify it
void CColumnDlg::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
  // This code only works with header controls.
  ASSERT(lpDrawItemStruct->CtlType == ODT_HEADER);
  HDITEM hdi;
  TCHAR  lpBuffer[256];
  hdi.mask = HDI_TEXT;
  hdi.pszText = lpBuffer;
  hdi.cchTextMax = 256;
  GetItem(lpDrawItemStruct->itemID, &hdi);  // Draw the button frame.
  ::DrawFrameControl(lpDrawItemStruct->hDC,
    &lpDrawItemStruct->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH);
  // Draw the text items using the text color red.
  COLORREF crOldColor = ::SetTextColor(lpDrawItemStruct->hDC,
    RGB(255,0,0));
  ::DrawText(lpDrawItemStruct->hDC, lpBuffer, strlen(lpBuffer),
    &lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
  ::SetTextColor(lpDrawItemStruct->hDC, crOldColor);
}

thanks in advance
Posted
Updated 3-Apr-11 18:57pm
v2

There should be .rc file inside which
lpDrawItemStruct->itemID
this would be defined.

So, make sure you added the .rc file in your project.
 
Share this answer
 
That comes because your dialog hasn't such a method.
:-)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900