You can do like this in OnSize.(Just a pseudo code)
if(m_bSizeAvailable == TRUE)
{
CRect tempRect;
m_wndToolBar.GetItemRect(0,&tempRect);
m_wndToolBar.SetSizes(CSize(tempRect.Width(),cy/10),CSize(16,15));
m_wndToolBar.SetHeight(cy/10);
}
CFrameWnd::OnSize(nType, cx, cy);
you have to take care of lot of things like,
The button Image size (2nd parameter in
SetSizes()
function).Because if the images size must be less than the button size.(atleast 7 pixels on x and 6 pixels on y).