CMFCPropertyGridCtrl Class
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
Supports an editable property grid control that can display properties in alphabetical or hierarchical order.
class CMFCPropertyGridCtrl : public CWnd
Members
Public Constructors
Name |
Description |
---|---|
Constructs a CMFCPropertyGridCtrl object. |
|
CMFCPropertyGridCtrl::~CMFCPropertyGridCtrl |
Destructor. |
Public Methods
Name |
Description |
---|---|
CMFCPropertyGridCtrl::accHitTest |
Called by the framework to retrieve the child element or child object at a given point on the screen. (Overrides CWnd::accHitTest.) |
CMFCPropertyGridCtrl::accLocation |
Called by the framework to retrieve the specified object's current screen location. (Overrides CWnd::accLocation.) |
Called by the framework to modify the selection or move the keyboard focus of the specified object. (Overrides CWnd::accSelect.) |
|
Adds a new property to a property grid control. |
|
|
|
Closes the color selection dialog box. |
|
Creates a property grid control and attaches it to the property grid control object. |
|
Deletes the specified property from the property grid control. |
|
|
|
Enables or disables the description area that is displayed underneath the list of properties. |
|
Enables or disables the header control at the top of the property grid control. |
|
Scrolls a property grid control and expands property items until the specified property is visible. |
|
Expands or collapses all property grid control nodes. |
|
Retrieves the property that is associated with a user-defined DWORD value. |
|
CMFCPropertyGridCtrl::get_accChild |
Called by the framework to retrieve the address of an IDispatch interface for the specified child. (Overrides CWnd::get_accChild.) |
Called by the framework to retrieve the number of children belonging to this object. (Overrides CWnd::get_accChildCount.) |
|
CMFCPropertyGridCtrl::get_accDefaultAction |
Called by the framework to retrieve a string that describes the object's default action. (Overrides CWnd::get_accDefaultAction.) |
CMFCPropertyGridCtrl::get_accDescription |
Called by framework to retrieve a string that describes the visual appearance of the specified object. (Overrides CWnd::get_accDescription.) |
Called by the framework to retrieve the object that has the keyboard focus. (Overrides CWnd::get_accFocus.) |
|
Called by the framework to retrieve an object's Help property string. (Overrides CWnd::get_accHelp.) |
|
Called by the framework to retrieve the full path of the WinHelpfile associated with the specified object and the identifier of the appropriate topic within that file. (Overrides CWnd::get_accHelpTopic.) |
|
Called by the framework to retrieve the specified object's shortcut key or access key. (Overrides CWnd::get_accKeyboardShortcut.) |
|
CMFCPropertyGridCtrl::get_accName |
Called by the framework to retrieve the name of the specified object. (Overrides CWnd::get_accName.) |
CMFCPropertyGridCtrl::get_accRole |
Called by the framework to retrieve information that describes the role of the specified object. (Overrides CWnd::get_accRole.) |
Called by the framework to retrieve the selected children of this object. (Overrides CWnd::get_accSelection.) |
|
CMFCPropertyGridCtrl::get_accState |
Called by the framework to retrieve the current state of the specified object. (Overrides CWnd::get_accState.) |
CMFCPropertyGridCtrl::get_accValue |
Called by the framework to retrieve the value of the specified object. (Overrides CWnd::get_accValue.) |
Retrieves the background color of the current property grid control. |
|
Retrieves the Windows font that of text in the current property grid control in bold style. |
|
Retrieves the currently selected property. |
|
Retrieves the custom colors that are currently defined for property grid control elements. |
|
Retrieves the height of the description area located at the bottom of the property grid control. |
|
Retrieves the number of rows in the description area of the current property grid control. |
|
Retrieves the internal CMFCHeaderCtrl object that the framework uses to display the current property grid control. |
|
Retrieves the height of the property grid control header. |
|
Retrieves the width of the left column of the current property grid control, which contains the name of each property. |
|
Retrieves the bounding rectangle of the property grid control. |
|
Retrieves a pointer to the property object that corresponds to the specified index of a property grid control item. |
|
Retrieves the current width of the column that contains property values. |
|
Retrieves the number of properties in a property grid control. |
|
Retrieves the height of a row in the property grid control. |
|
Retrieves a pointer to the scroll bar control in the property grid control. (Overrides CWnd::GetScrollBarCtrl.) |
|
Retrieves the color of the text of property items in the current property grid control. |
|
CMFCPropertyGridCtrl::GetThisClass |
Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type. |
Retrieves a pointer to the property object that corresponds to a property grid control item if a specified point is in the item. This method also indicates the area in the property grid control that contains the point. |
|
Initializes the internal CMFCHeaderCtrl object that the framework uses to display the current property grid control. |
|
Indicates whether a property grid control is in alphabetic mode. |
|
|
|
Indicates whether the description area of the property grid control is displayed. |
|
Indicates whether each property group name is displayed across the width of the current property grid control. |
|
Indicates whether the header control is displayed. |
|
Indicates how the property grid control displays modified properties. |
|
Indicates whether the framework redraws the name and value columns of the current property grid control when a user resizes the columns. |
|
Indicates whether the appearance of the property grid control is in the style that is used by VS .NET. |
|
Specifies how to display modified properties. |
|
CMFCPropertyGridCtrl::PreTranslateMessage |
Used by class CWinApp to translate window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions. (Overrides CWnd::PreTranslateMessage.) |
Removes all property objects from a property grid control. |
|
Restores the original value of all properties. |
|
Sets or resets alphabetical mode. |
|
Specifies the text of Boolean labels. |
|
Selects a property in a property grid control. |
|
Specifies custom colors for various property grid control elements. |
|
Specifies the number of rows to display in the description section of the current property grid control. |
|
Specifies whether to display the full width of the category name for a group of properties in the current property grid control. |
|
Defines a character that will be used as a delimiter in a list of property values. |
|
Specifies whether the framework redraws the name and value columns of the current property grid control when a user resizes the columns. |
|
Sets the appearance of the property grid control to the style that is used in VS .NET. |
|
Sets the color value of the currently selected color property. |
Protected Methods
Name |
Description |
---|---|
Redraws the property grid control and its properties. |
|
Called by the property grid control to sort properties. |
|
Called by the framework when the user starts to modify a property. |
|
Called by the framework when the user stops modifying a property. |
|
Called by the framework to initialize a property grid control. |
|
Called by the framework when the current selection is changed. |
|
Called by the framework when a property button is clicked. |
|
Called by the framework to draw a border around a property grid control. |
|
Called by the framework to draw the description area and display the description text. |
|
Called by the framework to display the list of properties in the property grid control. |
|
Called by the framework to display a property. |
|
Called by the framework when the value of a property is changed. |
|
Called by the framework when a property that contains a combo box control is selected. |
|
Called by the framework to validate property data. |
Remarks
The CMFCPropertyGridCtrl class displays a property grid control that contains editable properties derived from the CMFCPropertyGridProperty class. Each property can represent a type and it can contain subitems. The property grid control supports a resizable area at the bottom that can display the description of a selected property.
To use a property grid control, construct a CMFCPropertyGridCtrl object and then call the CMFCPropertyGridCtrl::Create method. Use the CMFCPropertyGridCtrl::AddProperty method to add properties to the list.
Selection Properties
Instead of representing a value, a property item can start a dialog box that enables the user to select a color, file, or font.
The following table lists four selection property types:
Class |
Description |
---|---|
A general purpose property that is used to specify the value of strings, Booleans, dates and so on. |
|
A property that is used to select a color value. |
|
A property that is used to select a file. |
|
A property that is used to select a font. |
Illustrations
The following illustrations depict a property grid control that displays properties in two ways. The first illustration displays properties hierarchically and the second displays properties alphabetically.
Example
The following example demonstrates how to configure a property grid control object by using various methods in the CMFCPropertyGridCtrl class. The example demonstrates how to enable the header control, enable the description area, and set the appearance of the property grid control. The example also shows how to set the alphabetic mode for the control whereby the control sorts all the properties it contains by their property name, and how to set the custom colors for various elements of the property grid control. This example is part of the New Controls sample.
CMFCPropertyGridCtrl m_wndPropList;
...
m_wndPropList.EnableHeaderCtrl();
m_wndPropList.EnableDescriptionArea();
m_wndPropList.SetVSDotNetLook(m_bDotNetLook);
// BOOL m_bMarkChanged
m_wndPropList.MarkModifiedProperties(m_bMarkChanged);
// BOOL m_bPropListCategorized
m_wndPropList.SetAlphabeticMode(!m_bPropListCategorized);
// BOOL m_bShowDragContext
m_wndPropList.SetShowDragContext(m_bShowDragContext);
...
// BOOL m_bMarkSortedColumn
m_wndList.EnableMarkSortedColumn(m_bMarkSortedColumn);
...
// BOOL m_bPropListCustomColors
// set custom colors for various elements of the property grid control
if (m_bPropListCustomColors)
{
m_wndPropList.SetCustomColors(RGB(228, 243, 254), RGB(46, 70, 165), RGB(200, 236, 209), RGB(33, 102, 49), RGB(255, 229, 216), RGB(128, 0, 0), RGB(159, 159, 255));
}
else
{
COLORREF c = (COLORREF)-1;
m_wndPropList.SetCustomColors(c, c, c, c, c, c, c);
}
m_wndPropList.RedrawWindow();
...
// restore original values of the properties
m_wndPropList.ResetOriginalValues();
Inheritance Hierarchy
Requirements
Header: afxpropertygridctrl.h