Use the dialog box as a subwindow

Source: Internet
Author: User

 

Using a dialog box as a subwindow is a very common technique, which simplifies the interface design and makes it easier to modify.

Simply put, the key to this technology is to create a modeless dialog box and specifyChild style and borderless style,.

Next, useCDialog and message ing. Use the following code to create a subwindow:

Int CMy59_s1View: OnCreate (maid)
  
{
  
If (CView: OnCreate (lpCreateStruct) =-1)
  
Return-1;
  
  
// Create a subwindow
  
M_dlgChild.Create (IDD_CHILD_DLG, this );
  
// Locate again
  
M_dlgChild.MoveWindow (0, 0, 400,200 );
  
// Display window
  
M_dlgChild.ShowWindow (SW_SHOW );
  
Return 0;
  
}
  

In addition, a similar technology is used.The CFormView derived class is used as a subwindow. When editing dialog box resources, you must specify the Child style and borderless style. Then, use ClassWizard to generate a derived class based on the CFormView class. However, since the member functions of this class are protected, you need to modify the generated header file as follows:

Class CTestForm: public CFormView
  
{
  
// Change the constructor and destructor to a common function.
  
Public:
  
CTestForm ();
  
Virtual ~ CTestForm ();
  
DECLARE_DYNCREATE (CTestForm)
  
Related Article

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.