Using an Unclipped Device Context
If you are absolutely certain that your control does not paint outside its client rectangle, you can realize a small but detectable speed gain by disabling the call to IntersectClipRect
that is made by COleControl
. To do this, remove the clipPaintDC flag from the set of flags returned by COleControl::GetControlFlags. For example:
DWORD CMyAxOptCtrl::GetControlFlags()
{
DWORD dwFlags = COleControl::GetControlFlags();
dwFlags &= ~clipPaintDC;
return dwFlags;
}
The code to remove this flag is automatically generated if you select the Unclipped Device Context option on the Control Settings page, when creating your control with the MFC ActiveX Control Wizard.
If you are using windowless activation, this optimization has no effect.