Forms multiple-document interface (MDI form) in the parent form is no way to add a control, we can add a picture control in the parent form, and then place the controls in the picture. However, the ensuing problem is that there is no way MDI child form is displayed, the picture controls to blocked, read through all kinds of information, as well as information found in some solutions. Share it with everyone.
First, why the MDI child form does not show up
Because the MDI program
Subform actually located MDI Client in
That is subform parent form the MDI Client
MDI is placed in picturebox same level and MDIClient
Hierarchy
ThunderMDIForm--MDIForm1
--MDIClient
---- ThunderFormDC - Form1 child form 1
---- ThunderFormDC - Form2 subform 2
--ThunderPictureBoxDC MDI in picturebox
Solution
1. API function that references a MDI parent form SetParen function
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
2. Enter the required form that appears click event
SetParent FrmIntroduction.hWnd, PicMain.hWnd
FrmIntroduction.Show
for example:
FrmIntroduction as the need arises subform, PicMain parent form of picture control name
Private Sub Introduction_Click()
SetParent FrmIntroduction.hWnd, PicMain.hWnd
FrmIntroduction.Show
End Sub
SetParent function explanation
Statement Method:
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Function: may be provided parent window pop-up window, or a laminated window subwindow
Function prototype: HWND SetParent (HWND hwndChild, HWND hWndNewParent)
Parameters: hwndChild child window handle
hWndNewParent new parent window handle (If this parameter is NULL, the desktop window becomes the new parent window)
Return Value: If the function succeeds, the return value of the original parent window handle child window; If the function fails, the return value is NULL. To obtain a multi-error information, call GetLastError.
Section presented here about the MDI form: see here
Because of the MFC explain the article, I found the corresponding articles on MFC more comprehensive, welcomed the transfer step: Click here