16,548
社区成员




class CStyleBar : public CMFCToolBar
{
public:
CComboBox m_comboBox;
CFont m_font;
};
static UINT BASED_CODE styles[] =
{
// same order as in the bitmap 'styles.bmp'
ID_SEPARATOR, // for combo box (placeholder)
//ID_SEPARATOR
};
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (!m_wndStyleBar.Create(this, WS_CHILD|WS_VISIBLE|CBRS_TOP|
CBRS_TOOLTIPS|CBRS_FLYBY, IDW_STYLES) ||
// !m_wndStyleBar.LoadBitmap(IDB_MENU_IMAGES_16) ||
!m_wndStyleBar.SetButtons(styles, sizeof(styles)/sizeof(UINT)))
{
TRACE0("Failed to create stylebar\n");
return FALSE; // fail to create
}
// Create the combo box
if (!m_wndStyleBar.m_comboBox.Create(
CBS_DROPDOWNLIST|WS_VISIBLE|WS_TABSTOP,
CRect(0, 0, 200, 280), &m_wndStyleBar, IDW_COMBO))
{
TRACE0("Failed to create combo-box\n");
return FALSE;
}
m_wndStyleBar.SetButtonInfo(0,IDW_COMBO, TBBS_SEPARATOR, 0);
}
错误:CMFCToolBarButton* pButton = GetButton(nIndex);
if (pButton == NULL)
{
ASSERT(FALSE);
return;
}