如何刷新 MFC 中的 Groupbox 控件 (C++)
How to refresh a Groupbox control in MFC (C++)
我在我的 MFC 视图中创建了一个 Groupbox class。但是在从 Maxmize 还原和从 Restore Down 还原到 Maxmize 时刷新失败。
我在 View::OnCreate
中创建了 Groupbox:
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);
...
}
我在 OnPaint
方法中使用 pmyGroupbox->ShowWindow(SW_HIDE)
和 pmyGroupbox->ShowWindow(SW_SHOW)
。我也测试了 pmyGroupbox->ShowWindow(SW_RESTORE)
但运气不好。控件总是无法刷新自身。
希望可以有人帮帮我。提前致谢。
这个问题()应该提供有用的信息。
如果您想创建一个带有控件的表单,例如组合框,您需要使用 CFormView
class。
关于这个主题还有一些其他有用的文章:
Q98598: HOWTO: Use CFormView
in SDI and MDI Applications
链接的文章提供了示例代码和说明。摘要如下:
SUMMARY
The CFormView
class provides a convenient method to place controls
into a view that is based on a dialog box template. The general
procedure to use a CFormView
is described in the documentation for the
class and is illustrated in the VIEWEX and CHKBOOK sample applications
provided with Microsoft Foundation Classes (MFC) versions 2.x and
above. However, these applications do not demonstrate making the
initial size of the frame window to be the same as the initial size of
the form.
The following section lists the steps required to support creating a
single document interface (SDI) or multiple document interface (MDI)
application based on a CFormView
, sizing the initial frame window
around the form, changing the style of the frame, and closing an MDI
document using a button in the form.
这些说明适用于 Visual Studio 的旧版本,因此您可能需要稍微调整一下。
我在我的 MFC 视图中创建了一个 Groupbox class。但是在从 Maxmize 还原和从 Restore Down 还原到 Maxmize 时刷新失败。
我在 View::OnCreate
中创建了 Groupbox:
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);
...
}
我在 OnPaint
方法中使用 pmyGroupbox->ShowWindow(SW_HIDE)
和 pmyGroupbox->ShowWindow(SW_SHOW)
。我也测试了 pmyGroupbox->ShowWindow(SW_RESTORE)
但运气不好。控件总是无法刷新自身。
希望可以有人帮帮我。提前致谢。
这个问题(
如果您想创建一个带有控件的表单,例如组合框,您需要使用 CFormView
class。
关于这个主题还有一些其他有用的文章:
Q98598: HOWTO: Use CFormView
in SDI and MDI Applications
链接的文章提供了示例代码和说明。摘要如下:
SUMMARY
The
CFormView
class provides a convenient method to place controls into a view that is based on a dialog box template. The general procedure to use aCFormView
is described in the documentation for the class and is illustrated in the VIEWEX and CHKBOOK sample applications provided with Microsoft Foundation Classes (MFC) versions 2.x and above. However, these applications do not demonstrate making the initial size of the frame window to be the same as the initial size of the form.The following section lists the steps required to support creating a single document interface (SDI) or multiple document interface (MDI) application based on a
CFormView
, sizing the initial frame window around the form, changing the style of the frame, and closing an MDI document using a button in the form.
这些说明适用于 Visual Studio 的旧版本,因此您可能需要稍微调整一下。