ON_WM_MEASUREITEM_REFLECT到底是怎么用的?
www.codeguru.com上改变CListCtrl每行高度的例子是
afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct );
ON_WM_MEASUREITEM_REFLECT( )
void CMyListCtrl::MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct )
{
LOGFONT lf;
GetFont()->GetLogFont( &lf );
if( lf.lfHeight < 0 )
lpMeasureItemStruct->itemHeight = -lf.lfHeight;
else
lpMeasureItemStruct->itemHeight = lf.lfHeight;
}
可是在我用的时候,创建CListCtrl时可以用,但改变CListCtrl大小时就报错。
错误代码是
Unhandled expection in TSTON32.EXE(MFC42D.DLL):0xC0000005:Access Violation
程序在此处停下。
_AFXWIN_INLINE int CFont::GetLogFont(LOGFONT* pLogFont)
{ ASSERT(m_hObject != NULL);
return ::GetObject(m_hObject, sizeof(LOGFONT), pLogFont); }
这是为什么?创建都可以通过,改变大小就不行?