Modifying OnCircleShapeChanged

Because CircleShape is a DISP_PROPERTY_NOTIFY property type, ClassWizard creates the code required to force a notification function to be called if the CircleShape property's value changes. The default OnCircleShapeChanged notification function, created by ClassWizard, sets the modified flag for the control.

The CircleShape property is a persistent property because it is initialized by calling the PX_Bool function in the COleControl::DoPropExchange function. The modified flag for persistent properties must be set by calling the COleControl::SetModifiedFlag function whenever the value of the persistent property has changed. Because most properties are persistent, ClassWizard includes a call to the CCircCtrl::SetModifiedFlag function in all notification functions.

If the value of the CircleShape property changes, the control must redraw itself to ensure that it displays the correct representation of the control, either a circle or an ellipse. This is done by invalidating the control when the OnCircleShapeChanged member function is called. The invalidation causes the OnDraw member function to be called.

Add the following lines of code to CIRCCTL.CPP:

    // force the control to redraw itself
    InvalidateControl();

as shown in the following code example:

void CCircCtrl::OnCircleShapeChanged()
{
    // force the control to redraw itself
    InvalidateControl();

    SetModifiedFlag();
}