初始化对话框时:
// TODO: Add extra initialization here
SendMessage(WM_DRAWITEM);
return TRUE; // return TRUE unless you set the focus to a control
}void CListDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: Add your message handler code here and/or call default
CRect rect;
switch(lpDrawItemStruct->CtlID)
{
case IDOK:
GetDlgItem(IDOK)->GetClientRect(&rect);
Transfer(&lpDrawItemStruct->hDC,&rect); break;
case IDCANCEL:
GetDlgItem(IDOK)->GetClientRect(&rect);
Transfer(&lpDrawItemStruct->hDC,&rect); break;
}
CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}void CListDlg::Transfer(HDC *dc, CRect *rect)
{}
BOOL CListDlg::OnInitDialog()
这一句吧,为甚麽去不去治呢?
LPDRAWITEMSTRUCT 你有初始化这句吗?错误提示说入口错了,我想应该是这句了建议: problem have to resolved by some changes in settings as given below
project properties -> general -> Project Defaults->Use of MFC
To set the properties "Use MFC In A Shared DLL "
好像是每个控件的每次绘制都会有这么一个消息,然后调用相应回调函数,根据参数
int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct
来识别控件对象和相应绘制的属性等
这里没有参数传过去,所以会在switch的时候出错吧?