Display hint text on mouseover

This class in MFC is called CToolTipCtrl, and the specific usage is very simple.
1. Declare the class object m_ctrlTT of CToolTipCtrl.
2. Set m_ctrlTT in the initialization function.
   EnableToolTips(TRUE);//enable use it
   m_ctrlTT.Create(this);
   m_ctrlTT.Activate(TRUE);
   m_ctrlTT.SetTipTextColor(RGB(0,0,255));//font color
   m_ctrlTT.SetDelayTime(150);//delay time
   //IDC_TEST is the control IDC you want to add a prompt to, "hello is the prompt statement you want to add"
   m_ctrlTT.AddTool(GetDlgItem(IDC_TEST),(LPCTSTR)"hello");
3. Add the PreTranslateMessage function in the ClassWizard and add The following statement:
   m_ctrlTT.RelayEvent(pMsg);

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325318184&siteId=291194637