共用方式為


CMFCPropertyGridProperty Class

A CMFCPropertyGridProperty object represents a list item in a property list control.

class CMFCPropertyGridProperty : public CObject

Members

Public Constructors

Name

Description

CMFCPropertyGridProperty::CMFCPropertyGridProperty

Constructs a CMFCPropertyGridProperty object.

CMFCPropertyGridProperty::~CMFCPropertyGridProperty

Destructor.

Public Methods

Name

Description

CMFCPropertyGridProperty::AddOption

Adds a new list item to a property list control.

CMFCPropertyGridProperty::AddSubItem

Adds a child item to a property.

CMFCPropertyGridProperty::AdjustButtonRect

Called by the parent property list control to tell a property to resize the bounding rectangle of an embedded button.

CMFCPropertyGridProperty::AdjustInPlaceEditRect

Retrieves the boundaries of the text box and optional spin button control that are used to set a property value.

CMFCPropertyGridProperty::AllowEdit

Makes a property either editable or read-only.

CMFCPropertyGridProperty::CreateInPlaceEdit

Called by the framework to create an editable control for a property.

CMFCPropertyGridProperty::CreateSpinControl

Called by the framework to create an editable spin button control.

CMFCPropertyGridProperty::Enable

Enables or disables a property.

CMFCPropertyGridProperty::EnableSpinControl

Enables or disables a spin button control that is used to modify a property value.

CMFCPropertyGridProperty::Expand

Expands or collapses a property that contains sub-properties.

CMFCPropertyGridProperty::FormatProperty

Formats the text representation of a property value.

CMFCPropertyGridProperty::GetData

Retrieves a DWORD value that is associated with a property.

CMFCPropertyGridProperty::GetDescription

Retrieves a property description.

CMFCPropertyGridProperty::GetExpandedSubItems

Retrieves the number of expanded sub-items.

CMFCPropertyGridProperty::GetHierarchyLevel

Retrieves the zero-based index of the property's hierarchy level.

CMFCPropertyGridProperty::GetName

Retrieves the name of the property.

CMFCPropertyGridProperty::GetNameTooltip

Called by the framework to display the name of the property in a tooltip.

CMFCPropertyGridProperty::GetOption

Retrieves the text of the option that is specified by an index.

CMFCPropertyGridProperty::GetOptionCount

Retrieves the number of options that belong to a property.

CMFCPropertyGridProperty::GetOriginalValue

Retrieves the initial value of the current property.

CMFCPropertyGridProperty::GetParent

Retrieves a pointer to a parent property.

CMFCPropertyGridProperty::GetRect

Retrieves the bounding rectangle of a property.

CMFCPropertyGridProperty::GetSubItem

Retrieves a sub-property identified by a zero-based index.

CMFCPropertyGridProperty::GetSubItemsCount

Retrieves the number of sub-items.

CMFCPropertyGridProperty::GetThisClass

Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.

CMFCPropertyGridProperty::GetValue

Retrieves a property value.

CMFCPropertyGridProperty::GetValueTooltip

Called by the framework to retrieve the text representation of the property value that is then displayed in a tooltip.

CMFCPropertyGridProperty::HitTest

Points to the property object that corresponds to the property list item that corresponds to a point.

CMFCPropertyGridProperty::IsAllowEdit

Indicates whether a property is editable.

CMFCPropertyGridProperty::IsEnabled

Indicates whether a property is enabled or disabled.

CMFCPropertyGridProperty::IsExpanded

Indicates whether a property is expanded or collapsed.

CMFCPropertyGridProperty::IsGroup

Indicates whether the current property represents a group.

CMFCPropertyGridProperty::IsInPlaceEditing

Indicates whether the current property is editable.

CMFCPropertyGridProperty::IsModified

Indicates whether the current property is modified.

CMFCPropertyGridProperty::IsParentExpanded

Indicates whether the parents of the current property are expanded.

CMFCPropertyGridProperty::IsSelected

Indicates whether the current property is selected.

CMFCPropertyGridProperty::IsVisible

Indicates whether the current property is visible.

CMFCPropertyGridProperty::OnClickButton

Called by the framework when the user clicks a button that is contained in a property.

CMFCPropertyGridProperty::OnClickName

Called by a parent property list control when a user clicks the name field of a property.

CMFCPropertyGridProperty::OnClickValue

Called by a parent property list control when a user clicks the value field of a property.

CMFCPropertyGridProperty::OnCloseCombo

Called by the framework when a combo box that is contained in a property is closed.

CMFCPropertyGridProperty::OnDblClk

Called by the framework when the user double clicks a property.

CMFCPropertyGridProperty::OnDrawButton

Called by the framework to draw a button that is contained in a property.

CMFCPropertyGridProperty::OnDrawDescription

Called by the framework to display the property description.

CMFCPropertyGridProperty::OnDrawExpandBox

Called by the framework to draw an expand box control near a property that contains sub-properties.

CMFCPropertyGridProperty::OnDrawName

Called by the framework to display the property name.

CMFCPropertyGridProperty::OnDrawValue

Called by the framework to display the property value.

CMFCPropertyGridProperty::OnEdit

Called by the framework when the user is about to modify a property value.

CMFCPropertyGridProperty::OnEndEdit

Called by the framework when the user is finished modifying a property value.

CMFCPropertyGridProperty::OnKillSelection

 

CMFCPropertyGridProperty::OnPosSizeChanged

 

CMFCPropertyGridProperty::OnRClickName

Called by the framework when the user clicks the right mouse button in the property name area.

CMFCPropertyGridProperty::OnRClickValue

Called by the framework when the user clicks the right mouse button in the property value area.

CMFCPropertyGridProperty::OnSelectCombo

Called by the framework when the user selects an item from the editable combo box.

CMFCPropertyGridProperty::OnSetCursor

Called by the framework when the mouse pointer moves to a property item.

CMFCPropertyGridProperty::OnSetSelection

 

CMFCPropertyGridProperty::OnUpdateValue

Called by the framework when the value of an editable property has changed.

CMFCPropertyGridProperty::PushChar

Called from the property list control when the property is selected and the user enters a new character.

CMFCPropertyGridProperty::Redraw

Redraws the property.

CMFCPropertyGridProperty::RemoveAllOptions

Removes all options (items) from a property.

CMFCPropertyGridProperty::RemoveSubItem

Removes the specified sub-item.

CMFCPropertyGridProperty::ResetOriginalValue

Restores the original value of an edited property.

CMFCPropertyGridProperty::SetData

Associates a DWORD value with a property.

CMFCPropertyGridProperty::SetDescription

Specifies the text that describes the current property.

CMFCPropertyGridProperty::SetName

Sets the name of a property.

CMFCPropertyGridProperty::SetOriginalValue

Sets the original value of an editable property.

CMFCPropertyGridProperty::SetValue

Sets the value of a property grid property.

CMFCPropertyGridProperty::Show

Shows or hides a property.

Protected Methods

Name

Description

CMFCPropertyGridProperty::CreateCombo

Called by the framework to add a combo box to a property.

CMFCPropertyGridProperty::HasButton

Indicates whether a property contains a button.

CMFCPropertyGridProperty::Init

Called by the framework to initialize a property object.

CMFCPropertyGridProperty::IsSubItem

Indicates whether the specified property is a sub-item of the current property.

CMFCPropertyGridProperty::IsValueChanged

Indicates whether the value of the current property has changed.

CMFCPropertyGridProperty::OnCtlColor

Called by the framework when it must retrieve a brush to fill the background color of a property.

CMFCPropertyGridProperty::OnDestroyWindow

Called by the framework when a property is destroyed or when editing is finished.

CMFCPropertyGridProperty::OnKillFocus

Called by the framework when the property loses the input focus.

Data Members

Name

Description

CMFCPropertyGridProperty::m_strFormatDouble

Format string for a value of type double.

CMFCPropertyGridProperty::m_strFormatFloat

Format string for a value of type float.

CMFCPropertyGridProperty::m_strFormatLong

Format string for a value of type long.

CMFCPropertyGridProperty::m_strFormatShort

Format string for a value of type short.

Remarks

Use a CMFCPropertyGridProperty object to represent a property, which you then add to a property list control. For more information, see CMFCPropertyGridCtrl Class.

A property object can represent data types such as strings, dates, and Boolean or integer values. It can contain child properties, or it can contain a control such as a combo box or a button control.

Example

The following example demonstrates how to construct a CMFCPropertyGridProperty object. The example also demonstrates how to use various methods in the CMFCPropertyGridProperty class to add an option, add a sub-item, enable a property, and show a property. This example is part of the New Controls sample.

    CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Appearance"));

    // construct a COleVariant object. 
    COleVariant var3DLook((short)VARIANT_FALSE, VT_BOOL);

    pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("3D Look"), var3DLook, 
        _T("Specifies the dialog's font will be nonbold and controls will have a 3D border")));

    CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Border"),
        _T("Dialog Frame"), _T("One of: None, Thin, Resizable, or Dialog Frame"));
    pProp->AddOption(_T("None"));
    pProp->AddOption(_T("Thin"));
    pProp->AddOption(_T("Resizable"));
    pProp->AddOption(_T("Dialog Frame"));
    pProp->AllowEdit(FALSE);

    pGroup1->AddSubItem(pProp);
    pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("Caption"), (COleVariant) _T("About NewControlsDemo"), _T("Specifies the text that will be displayed in the dialog's title bar")));
    pGroup1->AdjustButtonRect();
    pGroup1->AllowEdit();
    pGroup1->Enable();
    pGroup1->Show();
    pGroup1->Redraw();

Inheritance Hierarchy

CObject

   CMFCPropertyGridProperty

Requirements

Header: afxpropertygridctrl.h

See Also

Reference

Hierarchy Chart

CMFCPropertyGridCtrl Class

Other Resources

MFC Classes