博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MFC 实现CTreeCtrl单选
阅读量:7254 次
发布时间:2019-06-29

本文共 966 字,大约阅读时间需要 3 分钟。

void CDepartmenManager::SetUncheck(HTREEITEM hTree){	if (!hTree){		return;	}	m_DePartmentView.SetCheck(hTree, 0);	HTREEITEM hChild = m_DePartmentView.GetChildItem(hTree);	if (hChild){		SetUncheck(hChild);	}	else{		return;	}	HTREEITEM hBrothor = m_DePartmentView.GetNextSiblingItem(hChild);	while (hBrothor){		if (hBrothor){			SetUncheck(hBrothor);		}		else{			return;		}		hBrothor = m_DePartmentView.GetNextSiblingItem(hBrothor);	}}void CDepartmenManager::OnNMClickTree1(NMHDR *pNMHDR, LRESULT *pResult){	CPoint point;	GetCursorPos(&point);//获得鼠标点击的位置	m_DePartmentView.ScreenToClient(&point);//转化为客户坐标	SetUncheck(hRoot);	UINT uFlags;	CurrentItem = m_DePartmentView.HitTest(point, &uFlags);//获得当前点击节点的ITEM	if (uFlags & TVHT_ONITEM){		BOOL bState = m_DePartmentView.GetCheck(CurrentItem);		m_DePartmentView.SetCheck(CurrentItem, bState);	}		*pResult = 0;}

  

CTreeCtrl m_DePartmentView;
hRoot为根节点,
CurrentItem是临时节点

转载于:https://www.cnblogs.com/qq76211822/p/4818504.html

你可能感兴趣的文章
JavaWeb 返回json数据的两种方式
查看>>
(转)Java 详解 JVM 工作原理和流程
查看>>
关于如何获得数据库数据变化的情况(比定时查询方便多了)
查看>>
阿里员工都是这样排查Java问题的,附工具单(转)
查看>>
用flutter写一个精美的登录页面
查看>>
[转]Docker php extensions gd
查看>>
Java Program Mapping GB2312 to Unicode
查看>>
C语言标准中的逻辑位移和算术位移
查看>>
查看当前运行的SQL语句
查看>>
【Python】opencv显示图像
查看>>
Web配置文件(web.config)简介
查看>>
如何培养员工的团队合作精神
查看>>
POJ 1151 Atlantis (线段树)
查看>>
在sqlserver中如何根据字段名查找字段所在的表
查看>>
quality center 11备份最佳方案测试通过可用
查看>>
一本比较简单易懂的中文python入门教程
查看>>
CDN和双线机房相比有何优势
查看>>
soapui not supported the auto complete
查看>>
Tomcat配置并启用HTTPS
查看>>
javascript调用WebService - Hello World
查看>>