1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
BOOL MyTreeView::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
// TODO: Add your specialized code here and/or call the base class
switch (message)
{
case WM_MEASUREITEM:
MeasureItem((LPMEASUREITEMSTRUCT)lParam);
break;
//.........
return TRUE;
}
//-------------------------------------------------------------------
void MyTreeView::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
// TODO: Add your code to determine the size of specified item
CDC *pDC = GetDC();
if(m_bFont)
{
CFont* pOldFont = pDC->SelectObject(m_pFont);
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
lpMeasureItemStruct->itemHeight = tm.tmHeight + tm.tmExternalLeading;
lpMeasureItemStruct->itemHeight += lpMeasureItemStruct->itemHeight / 2;
pDC->SelectObject(pOldFont);
}
ReleaseDC(pDC);
} |
Partager