Partager via


CMFCPropertyGridCtrl::AddProperty

Adds a new property to a property grid control.

int AddProperty(
   CMFCPropertyGridProperty* pProp,
   BOOL bRedraw=TRUE,
   BOOL bAdjustLayout=TRUE 
);

Parameters

  • [in] pProp
    Pointer to a property.

  • [in] bRedraw
    TRUE to redraw the property immediately; otherwise, FALSE. The default value is TRUE.

  • [in] bAdjustLayout
    TRUE to recalculate how to draw the text and value of the property, and then draw the property; FALSE to use existing calculations to draw the property. The default value is TRUE.

Return Value

If this method succeeds, the zero-based index of the position in the property grid control where the property is added; otherwise, -1.

Remarks

This method adds a pointer to the specified property to the end of the list of properties in the property grid control. Do not destroy the properties or allow them to go out of scope before the grid control is destroyed. When you are done with the property grid control, call CMFCPropertyGridCtrl::RemoveAll to delete all the added properties. The AddProperty method fails if the specified property has already been added to the list.

Requirements

Header: afxpropertygridctrl.h

See Also

Reference

CMFCPropertyGridCtrl Class

Hierarchy Chart

CMFCPropertyGridCtrl::AdjustLayout