Setting the Default Background Color

The next step is to provide a default value for the control's background color. Normally, the background color of a control is the same as the background color of the control container's window, which can be obtained from the container's ambient properties.

COleControl implements a mechanism for obtaining the default values of stock properties. COleControl::OnResetState calls the function COleControl::DoPropExchange, which queries the container for its background color ambient property and sets the value of the control's BackColor property equal to this color.

In projects created by ControlWizard, the default background color is implemented automatically.