MFC 鼠标悬停在控件上,显示提示信息

1.鼠标悬停在控件上,显示提示信息
其中,Text Control控件需要把通知选项设为true:
cpp 复制代码
private:
	CToolTipCtrl m_Ttc;                                 //鼠标悬停提示 
	void SetToolTipsMsgMap();                           //鼠标悬停提示
	BOOL PreTranslateMessage(MSG* pMsg);				//处理键盘和鼠标消息
cpp 复制代码
BOOL Settings::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	EnableToolTips(true);     //使能悬停提示
	m_Ttc.Create(this);       //此窗口悬停提示
	SetToolTipsMsgMap();      //鼠标悬停提示
}
//处理键盘和鼠标消息
BOOL Settings::PreTranslateMessage(MSG* pMsg)
{
	CString cstrMessageOut;
	m_Ttc.RelayEvent(pMsg);     //鼠标悬停提示 
	return CDialog::PreTranslateMessage(pMsg);
}
//鼠标悬停提示
void Settings::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	m_Ttc.AddTool(GetDlgItem(IDC_STATIC), L"--");
	m_Ttc.AddTool(GetDlgItem(IDC_Combobox_sortMode), L"--");
	m_Ttc.AddTool(GetDlgItem(IDC_AllBuffer1),	  L"悬停提示1");
	m_Ttc.AddTool(GetDlgItem(IDC_Static_Number1), L"悬停提示2");
	m_Ttc.AddTool(GetDlgItem(IDC_Static_Number2), L"悬停提示3");
}
相关推荐
xlp666hub13 小时前
Leetcode第二题:用 C++ 解决字母异位词分组
c++·leetcode
不想写代码的星星14 小时前
static 关键字:从 C 到 C++,一篇文章彻底搞懂它的“七十二变”
c++
xlp666hub1 天前
Leetcode第一题:用C++解决两数之和问题
c++·leetcode
不想写代码的星星2 天前
C++继承、组合、聚合:选错了是屎山,选对了是神器
c++
不想写代码的星星3 天前
std::function 详解:用法、原理与现代 C++ 最佳实践
c++
樱木Plus5 天前
深拷贝(Deep Copy)和浅拷贝(Shallow Copy)
c++
blasit6 天前
笔记:Qt C++建立子线程做一个socket TCP常连接通信
c++·qt·tcp/ip
肆忆_7 天前
# 用 5 个问题学懂 C++ 虚函数(入门级)
c++
不想写代码的星星8 天前
虚函数表:C++ 多态背后的那个男人
c++
端平入洛9 天前
delete又未完全delete
c++