CMFCPropertyGridColorProperty Class
The CMFCPropertyGridColorProperty
class supports a property list control item that opens a color selection dialog box.
class CMFCPropertyGridColorProperty : public CMFCPropertyGridProperty
Name | Description |
---|---|
CMFCPropertyGridColorProperty::CMFCPropertyGridColorProperty | Constructs a CMFCPropertyGridColorProperty object. |
CMFCPropertyGridColorProperty::~CMFCPropertyGridColorProperty |
Destructor. |
Name | Description |
---|---|
CMFCPropertyGridColorProperty::EnableAutomaticButton | Enables the automatic button on the color selection dialog box. (The standard automatic button is labeled Automatic.) |
CMFCPropertyGridColorProperty::EnableOtherButton | Enables the other button on the color selection dialog box. (The standard other button is labeled More Colors.) |
CMFCPropertyGridColorProperty::FormatProperty |
Formats the text representation of a property value. (Overrides CMFCPropertyGridProperty::FormatProperty.) |
CMFCPropertyGridColorProperty::GetColor | Gets the current color of the property. |
CMFCPropertyGridColorProperty::GetThisClass |
Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type. |
CMFCPropertyGridColorProperty::OnClickButton |
Called by the framework when the user clicks a button that is contained in a property. (Overrides CMFCPropertyGridProperty::OnClickButton.) |
CMFCPropertyGridColorProperty::OnDrawValue |
Called by the framework to display the property value. (Overrides CMFCPropertyGridProperty::OnDrawValue.) |
CMFCPropertyGridColorProperty::OnEdit |
Called by the framework when the user is about to modify a property value. (Overrides CMFCPropertyGridProperty::OnEdit.) |
CMFCPropertyGridColorProperty::OnUpdateValue |
Called by the framework when the value of an editable property has changed. (Overrides CMFCPropertyGridProperty::OnUpdateValue.) |
CMFCPropertyGridColorProperty::SetColor | Sets a new color for the property. |
CMFCPropertyGridColorProperty::SetColumnsNumber | Specifies the number of columns in the current color property grid. |
CMFCPropertyGridColorProperty::SetOriginalValue | Sets the original value of an editable property. |
The CMFCPropertyGridColorProperty
class supports a color property that can be added to a property list control. For more information, see the CMFCPropertyGridCtrl Class.
The following example demonstrates how to construct an object of the CMFCPropertyGridColorProperty
class and configure this object by using various methods of the CMFCPropertyGridColorProperty
class. The code explains how to enable the automatic and other buttons, and how to set the color and the columns number. This example is part of the New Controls sample.
CMFCPropertyGridColorProperty *pColorProp = new CMFCPropertyGridColorProperty(_T("Window Color"), RGB(210, 192, 254), NULL, _T("Specifies the default dialog color"));
pColorProp->EnableOtherButton(_T("Other..."));
pColorProp->EnableAutomaticButton(_T("Default"), ::GetSysColor(COLOR_3DFACE));
pColorProp->SetColor(RGB(255, 0, 0));
pColorProp->SetColumnsNumber(3);
Header: afxpropertygridctrl.h
Constructs a CMFCPropertyGridColorProperty
object.
CMFCPropertyGridColorProperty(
const CString& strName,
const COLORREF& color,
CPalette* pPalette = NULL,
LPCTSTR lpszDescr = NULL,
DWORD_PTR dwData = 0);
strName
[in] The name of the property.
color
[in] The color value of the property.
pPalette
[in] Pointer to a palette of colors. The default value is NULL.
lpszDescr
[in] The property description. The default value is NULL.
dwData
[in] Application-specific data, such as an integer or a pointer to other data that is associated with the property. The default value is 0.
Enables the automatic button on the color selection dialog box. (The standard automatic button is labeled Automatic.)
void EnableAutomaticButton(
LPCTSTR lpszLabel,
COLORREF colorAutomatic,
BOOL bEnable=TRUE);
lpszLabel
[in] The label text of the automatic button.
colorAutomatic
[in] The RGB color value of the automatic (default) color.
bEnable
[in] TRUE to enable the automatic button; otherwise, FALSE. The default value is TRUE.
Enables the other button on the color selection dialog box. (The standard other button is labeled More Colors.)
void EnableOtherButton(
LPCTSTR lpszLabel,
BOOL bAltColorDlg = TRUE,
BOOL bEnable = TRUE);
lpszLabel
[in] The label text of the other button.
bAltColorDlg
[in] TRUE to display the CMFCColorDialog
dialog box; FALSE to display the standard color selection dialog box. The default value is TRUE.
bEnable
[in] TRUE to display the other button; otherwise, FALSE. The default value is TRUE.
Gets the current color of the property.
COLORREF GetColor() const;
An RGB color value.
Sets a new color for the property.
void SetColor(COLORREF color);
color
[in] An RGB color value.
Specifies the number of columns in the current color property grid.
void SetColumnsNumber(int nColumnsNumber);
nColumnsNumber
[in] The preferred number of columns in the color property grid.
This method sets the value of the m_nColumnsNumber
protected data member.
Sets the original value of an editable property.
virtual void SetOriginalValue(const COleVariant& varValue);
varValue
[in] A value.
Use the CMFCPropertyGridProperty::ResetOriginalValue method to reset the original value of an edited property.
Hierarchy Chart
Classes
CMFCPropertyGridCtrl Class
CMFCPropertyGridProperty Class