无法在mfc app中创建GroupBox

时间:2015-01-25 20:44:17

标签: c++ visual-studio-2010 mfc

CPanel * CWnd;
...
CPanel = new CWnd();
CPanel->Create(TEXT("STATIC"), L"PANELпанелька", WS_CHILD | WS_VISIBLE|BS_GROUPBOX,
    CRect(100, 100, 300, 300), this, 1234);
CPanel->SetWindowTextW(L"XFDSF");

编译完成后,我得到一个1px灰色边框没有标题的正方形。我做错了什么?

1 个答案:

答案 0 :(得分:4)

Groupbox是CButton。这个有效:

CButton *m_button;
m_button = new CButton();
CRect m_rec(10,10,150,80);
m_button->Create(L"Select",WS_CHILD | WS_VISIBLE | BS_GROUPBOX,m_rec, this, ID_BUTTON1);