- 先上效果图
2.步骤1,添加CToolTipCtrl对象
3. 步骤2,在OnInitDialog中添加CToolTipCtrl方法
终于找到不会显示颜色的问题的了,跟编译器环境有关在stdafx.h中屏蔽或者修还成多字集就可以了
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
4.添加消息响应函数
5. 修改Notify属性(有的吧博客说需要修改,我没有改还是会显示,估计实现方式不一样吧)
拓展:
这个只能实现CButton的,静态文本和Edit好像需要重写,也没仔细研究。如果想学习,传送下面链接。楼主网不好打不开
http://www.codeproject.com/Articles/1656/Message-Balloons
https://docs.microsoft.com/zh-cn/cpp/mfc/reference/ctooltipctrl-class?view=vs-2019(微软官网)