I created a Groupbox in my MFC view class. But failed in refresh it while Restore Down from Maxmize as well as Maxmize from Restore Down.

I create the Groupbox in View::OnCreate:
int Cmfc_gui_test3View::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
CRect mybox( 0, 0,350, 1000);
pmyGroupBox->Create(_T("Test GroupBox"), WS_CHILD | WS_VISIBLE | BS_CENTER | BS_GROUPBOX|WS_BORDER, mybox, this, IDG_GROUPBOX1);
...
}
And I am using pmyGroupbox->ShowWindow(SW_HIDE) and pmyGroupbox->ShowWindow(SW_SHOW) in OnPaint method. I also tested pmyGroupbox->ShowWindow(SW_RESTORE) but no lucky. The control always failed in refreshing itself.
Hope someone can help me. Thanks in advance.
This question (Can a MFC dialog resource be attached to a CChildView?) should provide useful information.
You need to use the
CFormViewclass if you want to create a form that has controls on it, like combo boxes.There are some other useful articles on this subject:
Q98598: HOWTO: Use
CFormViewin SDI and MDI ApplicationsThe linked article provides sample code and instructions. The summary reads:
The instructions are for older versions of Visual Studio so you might have to tweak a little.