MFC中CToolTipCtrl控件的使用

https://docs.microsoft.com/zh-cn/cpp/mfc/reference/ctooltipctrl-class

1.在对话框类中添加成员变量
CToolTipCtrl m_ttc;

2.在OnInitDialog()中初始化

m_ttc.Create(this);
m_ttc.AddTool(GetDlgItem(IDC_BUTTON1), _T("1"));

3.重写PreTranslateMessage(MSG* pMsg)

BOOL CcalculatorDlg::PreTranslateMessage(MSG* pMsg)
{
       // TODO: 在此添加专用代码和/或调用基类
       m_ttc.RelayEvent(pMsg);
       return CDialog::PreTranslateMessage(pMsg);
}

你可能感兴趣的:(MFC中CToolTipCtrl控件的使用)