CMFCPropertyGridToolTipCtrl Class
Implements a tooltip control that the CMFCPropertyGridCtrl Class uses to display tooltips.
Syntax
class CMFCPropertyGridToolTipCtrl : public CWnd
Members
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. |
Remarks
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.
Example
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"));
Inheritance Hierarchy
Requirements
Header: afxpropertygridtooltipctrl.h
CMFCPropertyGridToolTipCtrl::CMFCPropertyGridToolTipCtrl
Constructs a CMFCPropertyGridToolTipCtrl
object.
CMFCPropertyGridToolTipCtrl::CMFCPropertyGridToolTipCtrl();
CMFCPropertyGridToolTipCtrl::Create
Creates a window for the tooltip control.
BOOL Create(CWnd* pWndParent);
Parameters
pWndParent
[in] A pointer to the parent window.
Return Value
TRUE if the window was successfully created; otherwise, FALSE.
CMFCPropertyGridToolTipCtrl::Deactivate
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.
CMFCPropertyGridToolTipCtrl::GetLastRect
Returns the coordinates of the last position of the tooltip control.
void GetLastRect(CRect& rect) const;
Parameters
rect
[out] Contains the last position of the tooltip control.
CMFCPropertyGridToolTipCtrl::Hide
Hides the tooltip control.
void Hide();
CMFCPropertyGridToolTipCtrl::SetTextMargin
Sets the spacing between the tooltip text and the border of the tooltip window.
void SetTextMargin(int nTextMargin);
Parameters
nTextMargin
[in] Specifies the spacing between the tooltip control text and the border of the tooltip window. The default value is 10 pixels.
CMFCPropertyGridToolTipCtrl::Track
Displays the tooltip control.
void Track(
CRect rect,
const CString& strText);
Parameters
rect
[in] Specifies the position and size of the tooltip control.
strText
[in] 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.
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for