共用方式為


Manipulating the Tool Tip Control

Class CToolTipCtrl provides a group of member functions that control the various attributes of the CToolTipCtrl object and the tool tip window.

The initial, pop-up, and reshow durations for the tool tip windows can be set and retrieved with calls to GetDelayTime and SetDelayTime.

Change the appearance of the tool tip windows with the following functions:

In order for the tool tip control to be notified of important messages, such as WM_LBUTTONXXX messages, you must relay the messages to your tool tip control. The best method for this relay is to make a call to CToolTipCtrl::RelayEvent, in the PreTranslateMessage function of the owner window. The following example illustrates one possible method (assuming the tool tip control is called m_ToolTip):

BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
   if(pMsg->message== WM_LBUTTONDOWN ||
      pMsg->message== WM_LBUTTONUP ||
      pMsg->message== WM_MOUSEMOVE)
   {
      m_ToolTipCtrl.RelayEvent(pMsg);
   }

   return CDialog::PreTranslateMessage(pMsg);
}

To immediately remove a tool tip window, call the Pop member function.

See Also

Concepts

Using CToolTipCtrl

Controls (MFC)