处理一下该控件的WM_LBUTTONDOWN消息,再用HitTest就可以知道用户选择了哪一项了。
example:
UINT uFlags;
HTREEITEM hItem = pmyTreeCtrl-> HitTest(myPoint, &uFlags);
if ((hItem != NULL) && (TVHT_ONITEM & uFlags))
{
pmyTreeCtrl-> Select(hItem, TVGN_CARET);
}
uFlags可以是:
TVHT_ABOVE Above the client area.
TVHT_BELOW Below the client area.
TVHT_NOWHERE In the client area, but below the last item.
TVHT_ONITEM On the bitmap or label associated with an item.
TVHT_ONITEMBUTTON On the button associated with an item.
TVHT_ONITEMICON On the bitmap associated with an item.
TVHT_ONITEMINDENT In the indentation associated with an item.
TVHT_ONITEMLABEL On the label (string) associated with an item.
TVHT_ONITEMRIGHT In the area to the right of an item.
TVHT_ONITEMSTATEICON On the state icon for a tree-view item that is in a user-defined state.
TVHT_TOLEFT To the left of the client area.
TVHT_TORIGHT To the right of the client area
在TreeCtrl控件中,加入了checkbox的风格。那当我在checkbox 中打勾时会引发什么消息呀
最新推荐文章于 2021-10-02 23:53:34 发布