CMFCPropertyGridToolTipCtrl Class
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CMFCPropertyGridToolTipCtrl Class.
Implements a tooltip control that the CMFCPropertyGridCtrl Class uses to display tooltips.
class CMFCPropertyGridToolTipCtrl : public CWnd
Public Constructors
| Name | Description |
| CMFCPropertyGridToolTipCtrl::CMFCPropertyGridToolTipCtrl | Constructs a CMFCPropertyGridToolTipCtrl object. |
CMFCPropertyGridToolTipCtrl::~CMFCPropertyGridToolTipCtrl | Destructor. |
Public Methods
| Name | Description |
| CMFCPropertyGridToolTipCtrl::Create | Creates a window for the tooltip control. |
| CMFCPropertyGridToolTipCtrl::Deactivate | Deactivates and hides the tooltip control. |
| CMFCPropertyGridToolTipCtrl::GetLastRect | Returns the coordinates of the last position of the tooltip control. |
| CMFCPropertyGridToolTipCtrl::Hide | Hides the tooltip control. |
CMFCPropertyGridToolTipCtrl::PreTranslateMessage | Used by class CWinApp to translate window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions. (Overrides CWnd::PreTranslateMessage.) |
| CMFCPropertyGridToolTipCtrl::SetTextMargin | Sets the spacing between the tooltip text and the border of the tooltip window. |
| CMFCPropertyGridToolTipCtrl::Track | Displays the tooltip control. |
Tooltips are displayed when the pointer rests on a property name. The CMFCPropertyGridToolTipCtrl class displays a tooltip so that it is easily readable by the user. Usually, the position of a tooltip is determined by the position of the pointer. By using this class, the tooltip appears over the property name and resembles the natural property extension, so that the property name is fully visible.
MFC automatically creates this control and uses it in the CMFCPropertyGridCtrl Class.
The following example demonstrates how to construct an object of the CMFCPropertyGridToolTipCtrl class, and how to display the tooltip control.
CMFCPropertyGridToolTipCtrl* pToolTipCtrl = new CMFCPropertyGridToolTipCtrl();
CRect crect(1,1,50,50);
pToolTipCtrl->Track( crect, _T("this is a tool tip control"));
Header: afxpropertygridtooltipctrl.h
Constructs a CMFCPropertyGridToolTipCtrl object.
CMFCPropertyGridToolTipCtrl::CMFCPropertyGridToolTipCtrl();
Creates a window for the tooltip control.
BOOL Create(CWnd* pWndParent);
Parameters
[in] pWndParent
A pointer to the parent window.
Return Value
TRUE if the window was successfully created; otherwise, FALSE.
Deactivates and hides the tooltip control.
void Deactivate();
Remarks
This method sets the last position and text to empty values, so that future calls to CMFCPropertyGridToolTipCtrl::Track display the tooltip.
Returns the coordinates of the last position of the tooltip control.
void GetLastRect(CRect& rect) const;
Parameters
[out] rect
Contains the last position of the tooltip control.
Hides the tooltip control.
void Hide();
Sets the spacing between the tooltip text and the border of the tooltip window.
void SetTextMargin(int nTextMargin);
Parameters
[in] nTextMargin
Specifies the spacing between the tooltip control text and the border of the tooltip window. The default value is 10 pixels.
Displays the tooltip control.
void Track(
CRect rect,
const CString& strText);
Parameters
[in] rect
Specifies the position and size of the tooltip control.
[in] strText
Specifies the text to be shown in the tooltip.
Remarks
This method displays the tooltip control at the position and size specified by rect. If the position, size, and text have not changed since the last time this method was called, this method has no effect.