You can send WM_SETREDRAW messages to the MainForm ClientHandle, one with the wParam parameter set to False and then setting wParam to True to avoid flickering when setting up the MDI child window, for example:
Delphi:
SendMessage(Application.MainForm.ClientHandle, WM_SETREDRAW, False, 0); try Child := TChildForm.Create(Self); Child.Left := ...; Child.Top := ...; Child.Show; finally SendMessage(Application.MainForm.ClientHandle, WM_SETREDRAW, True, 0); InvalidateRect(Application.MainForm.ClientHandle, nil, True); end;
C ++:
SendMessage(Application->MainForm->ClientHandle, WM_SETREDRAW, FALSE, 0); try { Child = new TChildForm(this); Child->Left = ...; Child->Top = ...; Child->Show(); } __finally { SendMessage(Application->MainForm->ClientHandle, WM_SETREDRAW, TRUE, 0); InvalidateRect(Application->MainForm->ClientHandle, NULL, TRUE); }
source share