TreeCtrl 树控件(一些第三方类)在win7下不能多选的解决办法。

The problem seems to be that when using Unicode instead of MBCS, setting TVIS_FOCUSED attribute resets TVIS_SELECTED for current selected item. Thus for shift selection the function DoPreSelection must be corrected by adding 

if (m_hSelect != hItem)

 SetItemState( m_hSelect, TVIS_SELECTED, TVIS_SELECTED); //JP !!!

after the first SetItemState call. Similarily for control key in DoAction after if (nDone == 1) add:

HTREEITEM hSel = GetSelectedItem(); //added

SetItemState(hItem, TVIS_FOCUSED|nState, TVIS_FOCUSED|TVIS_SELECTED); //existing

if (hSel != NULL && hSel != hItem) //added

 SetItemState( hSel, TVIS_SELECTED, TVIS_SELECTED); //added

http://www.codeguru.com/cpp/controls/treeview/multiview/article.php/c9219/Advanced-Tree-Control.htm

解决办法是一位朋友回复的。

你可能感兴趣的:(win7)