adding combo to toolbar
Hi,
I want to put a combo box on a toolbar. The following is my code. The
combobox showed, but the size is not enlarged, it still the same size
as other toolbar button. Can any one tell me how to fix this? Thanks
int nToolBtnCnt = pToolBar->GetToolBarCtrl().GetButtonCount();
//convert last button to a seperator and get its position
RECT lastBtnRect;
UINT nID, nStyle;
int nImage;
pToolBar->GetButtonInfo( nToolBtnCnt-1, nID, nStyle, nImage );
pToolBar->SetButtonInfo( nToolBtnCnt-1, nID, TBBS_SEPARATOR, 160 );
pToolBar->GetItemRect( nToolBtnCnt-1, &lastBtnRect );
//expand the rectangle to allow the combo box room to drop down
lastBtnRect.top+=2;
lastBtnRect.bottom += 200;
m_pComboBox = boost::shared_ptr<CScaleCombo>( new CScaleCombo() );
m_pComboBox->Create(WS_CHILD|WS_VISIBLE | CBS_AUTOHSCROLL |
CBS_DROPDOWNLIST |CBS_HASSTRINGS ,lastBtnRect, pToolBar.get(),
CScaleCombo::COMBO_ID);
int* pScaleFactors = m_pComboBox->GetScaleFactors();
for(int i=0; i<CScaleCombo::FACTOR_COUNT; i++) {
stringstream ss;
ss<<pScaleFactors[i]<<"%";
std::string str= ss.str();
m_pComboBox->AddString(str.c_str() );
}
m_pComboBox->SetCurSel(3);//default 100%
m_pComboBox->ShowWindow( SW_SHOW );