可以,在插入前你先设置下TREECONTRL的CFont就可以了

解决方案 »

  1.   


    void CPageContact::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
    {
        LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
        // TODO: Add your control notification handler code here
        *pResult = CDRF_DODEFAULT;
        
        // If this is the beginning of the control's paint cycle, request
        // notifications for each item.
        if ( CDDS_PREPAINT == pNMCD->dwDrawStage )
        {
            *pResult = CDRF_NOTIFYITEMDRAW;
        }
        else if ( CDDS_ITEMPREPAINT == pNMCD->dwDrawStage )
        {
            // This is the pre-paint stage for an item.  We need to make another
            // request to be notified during the post-paint stage.        *pResult = CDRF_NOTIFYPOSTPAINT;
        }
        else if ( CDDS_ITEMPOSTPAINT == pNMCD->dwDrawStage )
        {
            // If this item is selected, re-draw the icon in its normal
            // color (not blended with the highlight color).
            LVITEM rItem;
            int    nItem = static_cast<int>( pNMCD->dwItemSpec);        ZeroMemory ( &rItem, sizeof(LVITEM) );
            rItem.mask  = LVIF_IMAGE | LVIF_STATE;
            rItem.iItem = nItem;
            rItem.stateMask = LVIS_SELECTED;
            GetItem ( &rItem );
            
            // If this item is selected, redraw the icon with its normal colors.
            if ( rItem.state & LVIS_SELECTED )
            {
                CDC*  pDC = CDC::FromHandle(pNMCD->hdc);
                CRect rcIcon;            // Get the rect that holds the item's icon.
                GetItemRect ( nItem, &rcIcon, LVIR_ICON );            // Draw the icon.
                m_ImageLst.Draw ( pDC, rItem.iImage, rcIcon.TopLeft(),
                                  ILD_TRANSPARENT );
               
                *pResult = CDRF_SKIPDEFAULT;
            }
          
         }
    }