//添加工具条
 if (!m_wndtoolbar.CreateEx(this,TBSTYLE_FLAT,  WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS ,
        CRect(4,4,0,0)) || !m_wndtoolbar.LoadToolBar(IDR_TOOLBAR))
 {
  MessageBox("创建工具栏失败!", "错误", MB_ICONSTOP);
  return FALSE;
 }

 m_wndtoolbar.ShowWindow(SW_SHOW);
 RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

CWnd::RepositionBars

This method repositions and resizes control bars in the client area of a window. The nIDFirst and nIDLast parameters define a range of control-bar identifiers to be repositioned in the client area. The nIDLeftOver parameter specifies the identifier of the child window, usually the view, which is repositioned and resized to fill the rest of the client area not filled by control bars.

posted on 2011-08-10 19:33  role  阅读(259)  评论(0编辑  收藏  举报