Article ID: 200099
Article Last Modified on 8/27/2002
BEGIN_MESSAGE_MAP(CMyView, CFormView)
ON_WM_MEASUREITEM()
...
END_MESSAGE_MAP()
// WM_MEASUREITEM is sent to parent of list control
void CMyView::OnMeasureItem(int nIDCtl,
LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
if (nIDCtl == IDC_LIST1) {
// Calculate appropriate font height.
int newHeight = 0;
CFont* pFont = (CFont*)GetFont();
if (pFont) {
LOGFONT lf;
pFont->GetLogFont(&lf);
newHeight = (lf.lfHeight > 0) ? lf.lfHeight : -lf.lfHeight;
}
// Set new itemHeight, use 14 as default height.
lpMeasureItemStruct->itemHeight = newHeight ? newHeight : 14;
}
CFormView::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
}
IDC_LIST1 is the ID of the owner-drawn ListView control.
Additional query words: ownerdrawn ownerdraw CListCtrl list view WLM 4.0 4.1 4.2 owner-draw
Keywords: kbprb KB200099