Share via


Manipulating the Tool Tip Control

OverviewSample

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 and .

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

  • and     Retrieves and sets the width between the tool tip border and the tool tip text.

  • and    Retrieves and sets the maximum width of the tool tip window.

  • and    Retrieves and sets the background color of the tool tip window.

  • and    Retrieves and sets the text color of the tool tip window.

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

if(pMsg->message== WM_LBUTTONDOWN ||
        pMsg->message== WM_LBUTTONUP ||
        pMsg->message== WM_MOUSEMOVE)
m_ToolTip.RelayEvent(pMsg);

return CMyView::PreTranslateMessage(pMsg);

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

See Also   Windows Common Controls and MFC Classes