1.鼠标悬停在控件上,显示提示信息
其中,Text Control控件需要把通知选项设为true:
private:
CToolTipCtrl m_Ttc;
void SetToolTipsMsgMap();
BOOL PreTranslateMessage(MSG* pMsg);
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");
}