VC MFC controls overlap

Source: Internet
Author: User

For example: If you want to put a button m_btn on the Treectrl, and always stay in front of Treectrl, you can do this

M_treectrl.modifystyle (0, Ws_clipchildren); m_btn. SetParent (Cwnd::fromhandle (M_treectrl.m_hwnd));


However, when SetParent is added, the click event does not respond and should be handled in the PreTranslateMessage function of its new parent window class, such as:

BOOL ctoolstatic::P retranslatemessage (msg* pMsg) {//Todo:add your specialized code here and/or call the base Classif (pMs G->message==wm_lbuttonup && GetWindowLong (pmsg->hwnd,gwl_id) ==idc_button1) {//Self-handling button click event Response}return CStatic::P retranslatemessage (PMSG);}


VC MFC controls overlap

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.