使用Win32在树控件中进行多项选择 [英] Multiple selection in tree control using Win32

查看:127
本文介绍了使用Win32在树控件中进行多项选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

是否有人在树控件中进行了多项选择
使用win32 ..

我在这里被卡住以作选择

我只有树控件的winProc,所以如何处理
在其中

请回复其非常紧急的依据

:)

非常感谢
.

Hello,

Did anybody did the multiple selection in the tree control
using win32..

i stucked here for multiple selection

i have only winProc of tree control so how to handle
in it

Please reply its very urgent basis

:)

Many thanks
.

推荐答案

对于Win32 API
For Win32 API
ctrlTree.Create(WS_CHILD|TVS_HASBUTTONS|TVS_CHECKBOX|, ctrlRect, this, IDC_TREECTRL);


然后检查NM_CLICK事件的通知


Then check notification of NM_CLICK event

case NM_CLICK:
{
    POINT cursorPos; GetCursorPos(&cursorPos);
    ScreenToClient(hwndTree, &cursorPos);
    TVHITTESTINFO thinf;
    thinf.pt = cursorPos;
    TreeView_HitTest(hwndTree, &thinf);
    if (thinf.flags == TVHT_ONITEMSTATEICON)
    {
        //state changed: check the state of the item under the cursor
        BOOL isChecked = TreeView_GetCheckState(hwndTree, thinf.hItem);
        if (isChecked)
        // do something
        else
        // do nothing?
    }
}
break;




对于MFC
在表单设计器中,可以选择控件上的复选框"样式.
然后使用以下代码:




For MFC
At form designer selectenable the "Check boxes" style on your control.
Then use the following code:

DWORD dwLong = m_tree.GetWindowLong(GWL_EXSTYLE);
dwLong |= TVS_CHECKBOXES;
m_tree.SetWindowLong(GWL_EXSTYLE, dwLong);


如果可以使用WTL CTreeViewCtrl.
有关更多详细信息-
TreeCtrl-具有Windows Vista样式项选择的WTL树控件 [ ^ ]

谢谢.
If you can use WTL CTreeViewCtrl.
for more details-
TreeCtrl - A WTL tree control with Windows Vista style item selection[^]

thanks.


这篇关于使用Win32在树控件中进行多项选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆