美文网首页C++/MFC
MFC中CToolTipCtrl控件的使用

MFC中CToolTipCtrl控件的使用

作者: blackOak | 来源:发表于2017-12-22 19:56 被阅读21次

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控件的使用

    本文链接:https://www.haomeiwen.com/subject/revxgxtx.html