Compartilhar via


Using an Unclipped Device Context

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at 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.

See Also

MFC ActiveX Controls: Optimization