c++ - item size not adjusted after font change in CTreeCtrl -


Text after "div class =" itemprop = "text">

I change the font of tree objects in CTreeCtrl with the following code:

  zero CTreeCtrlEx: : OnNMCustomdraw (NMHDR * pNMHDR, LRESULT * pResult) {LPNMTVCUSTOMDRAW pNMCD = reinterpret_cast & lt; LPNMTVCUSTOMDRAW & gt; (PNMHDR); * PResult = 0; Switches (PNMC-> nmcd.dwDrawStage) {Case CDDSPRAPTNT: * PRSLT = CDRF_NITIIFIITMAR; Return; Case CDDS_ITEMPREPAINT: {CFont * pco_font = GetSomeFont (); :: SelectObject (pNMCD-> nmcd.hdc, pco_font-> GetSafeHandle ()); * PResult = CDRF_NEWFONT; } Return; }}  

However, the item is being deducted at the end of the text, apparently it is not being adjusted for the length of the text with the new font.
What will be the remedy?

"itemprop =" text ">

I was the only problem and can confirm that CCM_SETVERSION did not work. In fact there was only one thing that works reliably for me, paint process after the end after text was to set up the way I did he grabbed TVN_ITEMEXPANDING message text Was set up again It will correct the text of all sub-objects during the expansion of the node. . Of course it does not work for the bold root nodes

Here is a sketch of my code:

  BEGIN_MESSAGE_MAP (CTreeViewEx, CTreeView) ON_NOTIFY_REFLECT (TVN_ITEMEXPANDING, OnItemExpanding) END_MESSAGE_MAP ( ) Zero CTreeViewEx :: OnItemExpanding (NMHDR * pNMHDR, LRESULT * pResult) {NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *) pNMHDR; If (pNMTreeView == faucet) {return; } HTREEITEM hTreeItem = pNMTreeView-> ItemNew.hItem; If (hTreeItem! = NULL) {ReevaluteItemTextOfChildren (hTreeItem); ...}} zero CTdTreeViewEx :: ReevaluteItemTextOfChildren (HTREEITEM hRootNode) {if (hRootNode == zero) {return; } CTreeCtrl & amp; CtlTree = GetTreeCtrl (); HTREEITEM hTreeItemCursor = ctlTree.GetNextItem (Hierotode, TVGN_CHILD); // while loop to all brothers (hTreeItemCursor! = NULL) to change the text {// existing item CString csItemText (ctlTree.GetItemText (hTreeItemCursor)); CtlTree.SetItemText (hTreeItemCursor, csItemText); // Get the next brother HTREEITEM hNextSibling = ctlTree.GetNextItem (hTreeItemCursor, TVGN_NEXT); HTreeItemCursor = hNextSibling; }}  

Comments