错误C2065:"GetItem":未声明的标识符 [英] error C2065: 'GetItem' : undeclared identifier
本文介绍了错误C2065:"GetItem":未声明的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
,,
我正在尝试使用绘制项目功能时更改列表控制标题,文本和背景色的颜色,我得到错误C2065:``GetItem'':未声明的标识符,此错误发生在这里:
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
推荐答案
应该有一个.rc文件,在其中定义
There should be .rc file inside which
lpDrawItemStruct->itemID
.
因此,请确保在项目中添加了.rc文件.
this would be defined.
So, make sure you added the .rc file in your project.
这是因为您的对话框没有这种方法.
:-)
That comes because your dialog hasn''t such a method.
:-)
这篇关于错误C2065:"GetItem":未声明的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文