//CMFCToolBarButton//第二个参数怎么关联Image图像列表的索引?
 m_wndToolBar.SetUserImage(&m_UserImages); //CMFCToolBar m_wndToolbar CMFCToolBarButton(
   UINT uiID,
   int iImage,
   LPCTSTR lpszText=NULL,
   BOOL bUserButton=FALSE,
   BOOL bLocked=FALSE
);
 Parameters
[in] uiID
The command ID of the button. [in] iImage
The image index of the button in the collection of images. [in] lpszText
The text label of the button. Can be NULL. [in] bUserButton
A Boolean value that determines whether the button is user-defined. If this parameter is TRUE, the button is user-defined. Otherwise, the button image is loaded from a resource. [in] bLocked
A Boolean value that determines whether the button can be customized. If this parameter is TRUE, the button cannot be customized. Otherwise, the button can be customized. 
 

解决方案 »

  1.   

     m_wndToolBar.SetUserImage(&m_UserImages); 这是整个集
    [in] iImage The image index of the button in the collection of images. 
    就是整个集里索引。
      

  2.   


         // CMFCToolBar       m_wndToolBar;
         // CMFCToolBarImages m_UserImages; 
         // CImageList        m_wndImage;
         //OnCreate函数里的DockPane(&m_wndOutput);加上下面的,怎么出不来图片啊?
    //m_wndProperties.EnableDocking(CBRS_ALIGN_ANY);
    //DockPane(&m_wndProperties);
    //m_wndToolBar.InsertButton(CMFCToolBarButton(ID_FILE_NEW,0,L""));
    m_wndImage.Create(32,32,ILC_COLOR32|ILC_MASK,0,0);
    m_wndImage.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
    m_wndImage.Add(AfxGetApp()->LoadIcon(IDI_ICON3));
    m_UserImages.CreateFromImageList(m_wndImage);
    m_UserImages.SetImageSize(CSize(32,32), TRUE);
    UINT nArray[2] = { ID_MENU1, ID_MENU1};  
    m_wndToolBar.SetButtons(nArray, 2);
    m_wndToolBar.SetSizes(CSize(32,32),CSize(32,32));
    m_wndToolBar.SetUserImages(&m_UserImages);
    m_wndToolBar.SetButtonInfo(0,ID_MENU1,TBBS_CHECKBOX,0);
      

  3.   

    //下面的图形集合对吗?
     m_wndImage.Create(32,32,ILC_COLOR32|ILC_MASK,0,0);     
    m_wndImage.Add(AfxGetApp()->LoadIcon(IDI_ICON2));     
    m_wndImage.Add(AfxGetApp()->LoadIcon(IDI_ICON3));     m_UserImages.CreateFromImageList(m_wndImage);    
     m_UserImages.SetImageSize(CSize(32,32), TRUE); 
      

  4.   

    m_wndImage.Create(32,32,ILC_COLOR32|ILC_MASK,0,0); 
    为什么2个0,第一个是知道的(2),
    第二个一般是 1,表示 备用 1个。 
      

  5.   

    0个 预备0个啊 之前用ctoolbar就行
      

  6.   

    DockPane调用之后,才可改变工具栏大小//
      

  7.   

    m_wndToolBar中有一个 immediate adjust什么的函数,调用一下试试。