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");
}