Dela via


CMFCPropertyGridColorProperty Class

The CMFCPropertyGridColorProperty class supports a property list control item that opens a color selection dialog box.

class CMFCPropertyGridColorProperty : public CMFCPropertyGridProperty

Members

Public Constructors

Name

Description

CMFCPropertyGridColorProperty::CMFCPropertyGridColorProperty

Constructs a CMFCPropertyGridColorProperty object.

CMFCPropertyGridColorProperty::~CMFCPropertyGridColorProperty

Destructor.

Public Methods

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.

Remarks

The CMFCPropertyGridColorProperty class supports a color property that can be added to a property list control. For more information, see the CMFCPropertyGridCtrl Class.

Example

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 NewControls Sample: MFC Controls Demonstration Application.

  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);

Inheritance Hierarchy

CObject

   CMFCPropertyGridProperty

      CMFCPropertyGridColorProperty

Requirements

Header: afxpropertygridctrl.h

See Also

Concepts

MFC Hierarchy Chart

Reference

CMFCPropertyGridCtrl Class

CMFCPropertyGridProperty Class

Other Resources

Classes (MFC Feature Pack)