这个函数是用于设置工具栏按钮大小,和显示图片大小的
如:m_ToolBar.SetSizes(CSize(60,56),CSize(24,24));没什么问题,
可我把大小改了一下,就出错了,Debug Asseration failed!这是怎么回啊,
改成这个就出错了
m_ToolBar.SetSizes(CSize(60,56),CSize(60,56));
而且是时候工具栏的大小也不是设置的那样。

解决方案 »

  1.   

    MSDN上有这样一句:CToolBar::SetSizes()  
    Call this member function to set the toolbar's buttons to the size, in pixels, specified in sizeButton. 
     
    void SetSizes(
       SIZE sizeButton,
       SIZE sizeImage 
    );
     
    The sizeImage parameter must contain the size, in pixels, of the images in the toolbar's bitmap. The dimensions in sizeButton must be sufficient to hold the image plus 7 pixels extra in width and 6 pixels extra in height. This function also sets the toolbar height to fit the buttons. 
      

  2.   

    那为什么设置不了工具按钮文本呢?
    m_Toolbar.SetButtonText(1,"abcd");
      

  3.   

    同问呢,改了就一直出现Debug Asseration failed! 
      

  4.   

    The dimensions in sizeButton must be sufficient to hold the image plus 7 pixels extra in width and 6 pixels extra in height. This function also sets the toolbar height to fit the buttons. 
    前面size的x要比后面的大7个像素,y要大6个像素
      

  5.   

    UINT Array[7];
    for(int i=0;i<7;i++)
    {
    Array[i]=9000+i;
    } m_Toolbar.Create(this);
    m_Toolbar.SetButtons(Array,7);