Info: Avoid ws_clipchildren and ActiveX Control painting Problems

Source: Internet
Author: User
Tags knowledge base
More information on this page

For more information about the MFC container methods, see common examples of the ATL container methods.

Summary

For Windows, in order to avoid the re-painting problem, it is used as the parent ActiveX control. In the local container, the ws_clipchildren window style must be used.

Back to Top

More information

When the ws_clipchildren style exclusion area is drawn in the parent window by the Child window:

Http://msdn.microsoft.com/library/psdk/winui/windows_2v90.htm (http://msdn.microsoft.com/library/psdk/winui/windows_2v90.htm)

The style must be used for the parent window object instead of being output by the local object. For Microsoft basic class (MFC) Ole (and ActiveDirectory) Documentation containers, the Framework implicitly sets the style during local activation. However, the style must be explicitly added. In other cases, local activation is involved. This is usually from the perspective of the MFC and the Active Template Library (ATL) container, when carrying ActiveX controls.

Back to Top

MFC container Methods


For ActiveX Control bearing (including cview and cdialog), you can add the style of the MFC cwnd derived class by adding a rewrite for the virtual precreatewindow () function and modifying the precreatewindow! Alink (settings. For example, precreatewindow will show the appearance in the cview derived class:

BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs){// Add the WS_CLIPCHILDREN style to avoid repaint problems:cs.style |= WS_CLIPCHILDREN;return CView::PreCreateWindow(cs);}

In the dialog box Editor, On the Style tab, you can add the ws_clipchildren style to the cdialog derived class by cutting the child level.

Back to Top

About the ATL container Method


For the container window ws_clipchildren style originating from csf-wimpl, the window feature can be specified. The ccontrolwintraits class of the cwindowimpl derived class does not include the default features specified in the ws_clipchildren style by default. For the ATL window class and window features, see the following Microsoft Web page:

ATL 3.0 window class: An Introduction) subtopic uses window properties to specify a style (: http://msdn.microsoft.com/library/techart/atlwindow.htm#atlwindow_topic13 (http://msdn.microsoft.com/library/techart/atlwindow.htm#atlwindow_topic13)
For an ATL-based dialog box, the caxdialogimpl base class is not derived from cwindowimpl, so it does not have these features. You cannot specify caxdialogimpl or custom cwintraits. You can add the ws_clipchildren style through the style tab in the dialog box editor.

Back to Top

Common Methods of MFC and ATL


If the window uses cwnd: Create (for MFC) or cwindow: Create (for ATL), you are creating a clear ws_clipchildren style specified by the dwstyle parameter.
For an MFC window or cwindow: modifystyle, the style is dynamically modified for an ATL window. Once the window has been created and has a valid hwnd, you can use cwnd: modifystyle.

Back to Top

Reference

Cwnd: precreatewindow http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfc_cwnd.3a3a.precreatewindow.htm (http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfc_cwnd.3a3a.precreatewindow.htm) cwnd: Create http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfc_cwnd.3a3a.create.htm (http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfc_cwnd.3a3a.create.htm) cwindow: Create http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/vcrefcwindowcreate.htm (http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/vcrefcwindowcreate.htm) cwnd: modifystyle http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfc_cwnd.3a3a.modifystyle.htm (http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfc_cwnd.3a3a.modifystyle.htm) cwindow: modifystyle http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_atl_cwindow.3a3a.modifystyle.htm (http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_atl_cwindow.3a3a.modifystyle.htm) for specific examples of correct painting, see the following Microsoft Knowledge Base Article:

220021 (http://support.microsoft.com/kb/220021/EN-US/) BUG: The chtmlview is not drawn correctly in the app MDI Application Wizard

The container window chtmlview acts as the Microsoft webbrowser control:

Http://msdn.microsoft.com/workshop/browser/webbrowser/WebBrowser.asp (http://msdn.microsoft.com/workshop/browser/webbrowser/WebBrowser.asp)

(C) Microsoft Corporation 2000 reserves all rights. Writer S. Ganesh, Microsoft Corporation.

Back to Top

The information in this article applies:
Microsoft ActiveX template library 3.0
Microsoft Foundation Class Library 4.2

 

 

For more technical articles, see Shi Changquan's personal website: http://www.joyvc.cn

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.