In addition to customizing the appearance of standard Property Inspector controls, a property source also may provide display instructions for each of its individual properties. Per-property customization allows you to
- Provide your own ActiveX editing control
- Define an icon that appears to the left of your property's editor
- Specify a custom bitmap for an ellipsis button
- Change the text color
- Enlarge the property's display so that it covers multiple rows in the Property Inspector grid
- Set a relative property weight
Objects implement the IAcPiPropertyDisplay interface to customize the display on a per-property basis. This is done with least effort by deriving from the IAcPiPropertyDisplayImpl template class and declaring a per-property display map. IAcPiPropertyDisplayImpl implements the entire IAcPiPropertyDisplay interface for you. To customize this implementation, you simply list your custom settings in the map. Each map entry provides the following information for a single property:
- The property's DISPID
- The PROGID of a custom ActiveX editing control (optional)
- Left-icon resource ID (optional)
- Left-icon type (optional)
- Ellipsis bitmap type (optional)
- Ellipsis bitmap resource ID (optional)
- Text color, expressed as an OLE_COLOR (optional)
- Full-view display switch
- Height, in number of rows
- Property weight
For example, the following map sets the color of a MyProp property to red (0x000000ff):
BEGIN_PERPROPDISPLAY_MAP() PROP_DISP_ENTRY(DISP_MYPROP, NULL, NULL, NULL, NULL, NULL, 0x000000ff, FALSE, 0, 0) END_PERPROPDISPLAY_MAP()
For static properties, the Property Inspector queries the object's or command's IUnknown interface for a pointer to the IAcPiPropertyDisplay interface. For dynamic properties, either the IDynamicProperty or IDynamicProperty2 interface is queried for this pointer. If a valid pointer is obtained, the Property Inspector invokes its methods to determine each property's custom display attributes. One method that is invoked is GetCustomPropertyCtrl(). Objects implement this method if they want their properties to be edited with a custom ActiveX control. The Property Inspector always consults this method before attempting to assign a stock control.
See the Implementing Dynamic Properties section for additional information on customizing dynamic property displays.