CToolTip Class |
Description
The CToolTip class adds support for the tool tip control. ToolTips appear automatically, or pop up, when the user pauses the mouse pointer over a tool or some other UI element. The ToolTip appears near the pointer and disappears when the user clicks a mouse button, moves the pointer away from the tool, or simply waits for a few seconds.
CToolTip Members
Construction | |
CToolTip | CToolTip();Constructs a tool tip control. |
CSize GetBubbleSize(LPTOOLINFO lpToolInfo) const;Returns the width and height of the ToolTip control.
int GetDelayTime(DWORD dwDuration) const;Retrieves the initial, pop-up, and reshow durations currently set for the ToolTip control.
void GetMargin(LPRECT lprc) const;Retrieves the top, left, bottom, and right margins set for the ToolTip window.
int GetMaxTipWidth() const;Retrieves the maximum width for the ToolTip window.
void GetText(CString& str, CWnd* pWnd, UINT_PTR nIDTool = 0) const;Retrieves the text from the tool tip control.
COLORREF GetTipBkColor() const;Retrieves the background color in the ToolTip window.
COLORREF GetTipTextColor() const;Retrieves the text color in a ToolTip window.
int GetToolCount() const;Retrieves a count of the tools maintained by the ToolTip control.
BOOL GetToolInfo(TOOLINFO& ToolInfo, CWnd* pWnd, UINT_PTR nIDTool = 0) const;Retrieves the information that a ToolTip control maintains about the tool.
void SetDelayTime(UINT nDelay);
void SetDelayTime(DWORD dwDuration, int iTime);Sets the initial, pop-up, and reshow durations for the ToolTip control
void SetMargin(LPRECT lprc);Sets the top, left, bottom, and right margins for the ToolTip window.
int SetMaxTipWidth(int iWidth);Sets the maximum width for the ToolTip window.
void SetTipBkColor(COLORREF clr);Sets the background color in the ToolTip window.
void SetTipTextColor(COLORREF clr);Sets the text color in the ToolTip window.
void SetToolInfo(LPTOOLINFO lpToolInfo);Sets the information that the ToolTip control maintains for a tool.
void Activate(BOOL bActivate);Activates or deactivates the ToolTip control.
BOOL AddTool(CWnd* pWnd, UINT nIDText, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);
BOOL AddTool(CWnd* pWnd, LPCTSTR lpszText = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);Registers a tool with a ToolTip control.
BOOL AdjustRect(LPRECT lprc, BOOL bLarger = TRUE);Calculates a ToolTip control's text display rectangle from its window rectangle, or the ToolTip window rectangle needed to display a specified text display rectangle.
void DelTool(CWnd* pWnd, UINT_PTR nIDTool = 0);Removes a tool from the ToolTip control.
BOOL HitTest(CWnd* pWnd, CPoint pt, LPTOOLINFO lpToolInfo) const;Tests a point to determine whether it is within the bounding rectangle of the specified tool and, if it is, retrieves information about the tool.
void Pop();Removes a displayed ToolTip window from view.
void RelayEvent(LPMSG lpMsg);Passes a mouse message to a ToolTip control for processing.
BOOL SetTitle(UINT uIcon, LPCTSTR lpstrTitle);Adds a standard icon and title string to a ToolTip.
void SetToolRect(CWnd* pWnd, UINT_PTR nIDTool, LPCRECT lpRect);Sets a new bounding rectangle for the tool.
void SetWindowTheme(LPCWSTR lpstrTheme);Sets the visual style of a ToolTip control.
void Update();Forces the current tool to be redrawn.
void UpdateTipText(LPCTSTR lpszText, CWnd* pWnd, UINT_PTR nIDTool = 0);
void UpdateTipText(UINT nIDText, CWnd* pWnd, UINT_PTR nIDTool = 0);Sets the ToolTip text for a tool.
Base class Members
For base class members, refer to the members of CWnd.
Remarks
ToolTip controls can display a single line of text or multiple lines. Their corners can be rounded or square. They might or might not have a stem that points to the tools like a cartoon speech balloon. ToolTip text can be stationary or can move with the mouse pointer, called tracking. Stationary text can be displayed adjacent to a tool or it can be displayed over a tool, which is referred to as in-place. Standard ToolTips are stationary, display a single line of text, have square corners, and have no stem pointing to the tool.
Summary Information
Header file | controls.h |
Win32/64 support | Yes |
WinCE support | Yes |