ToolBarCtrl中的插入button时, TBBUTTON并没该button的tooltip,请问如何在动态插入ToolBar按钮时, 指定该按钮的tooltip字符串?typedef struct _TBBUTTON {
int iBitmap;// zero-based index of button image
int idCommand;  // command to be sent when button pressed
BYTE fsState;   // button state--see below
BYTE fsStyle;   // button style--see below
DWORD dwData;   // application-defined value
int iString;// zero-based index of button label string
} TBBUTTON;InsertButton( int nIndex, LPTBBUTTON lpButton );

解决方案 »

  1.   

    int iBitmap;// zero-based index of button image
    int idCommand;  // command to be sent when button pressed
    BYTE fsState;   // button state--see below
    BYTE fsStyle;   // button style--see below
    DWORD dwData;   // application-defined value
    int iString;// zero-based index of button label string
    } TBBUTTON;BOOL InsertButton( int nIndex, LPTBBUTTON lpButton );
      

  2.   

    To activate tool tips in your application, you must do two things: Add the CBRS_TOOLTIPS style to the other styles (such as WS_CHILD, WS_VISIBLE, and other CBRS_ styles) passed as the dwStyle parameter to theCToolBar::Create function or inSetBarStyle.
    As described in the procedure below, append the toolbar tip text, separated by a newline character (‘\n’), to the string resource containing the command-line prompt for the toolbar command. The string resource shares the ID of the toolbar button.
      

  3.   

    我的工具条是有CBRS_ styles风格的啊,
    其它按钮都有tooltip, 就是动态插入的按钮没tooltip
      

  4.   

    也就是说
    首先,ToolBar要支持ToolTips
    也就是这里所说的
    “Add the CBRS_TOOLTIPS style to the other styles (such as WS_CHILD, WS_VISIBLE, and other CBRS_ styles) passed as the dwStyle parameter to theCToolBar::Create function or inSetBarStyle.”然后,用iString来指定你想要添加的按钮的字符串在数组中的下标
    要想添加该按钮的字符串值用addString();
    这时候关键来了,要想制定tips
    这个字符串的值后面要用"\n加tips的内容"
      

  5.   

    string whose index you provide must have previously been added to the toolbar control’s list using  AddString, and/or AddStrings.
      

  6.   

    m_tooltip.Creat(this);
    m_tooltip.Activate(true);
    m_tooltip.SetTipBkColor(RGB(233,33,33));
    m_tooltip.SetTipTextColor(RGB(0,0,200));
    m_tooltip.SetDelayTime(100);
    m_tooltip.AddTool(ID,"SSSS");
      

  7.   

    据个列子
    “关于”按钮,它的tips为“我的关于”
    则在addstrings(“\n我的关于”);
    addstrings的返回值就是该按钮的iString
      

  8.   

    同意 he_zhidan(我的QQ154168835)观点
      

  9.   

    用这个函数:
    void CToolBarCtrl::SetToolTips(CToolTipCtrl* pTip );
      

  10.   

    to he_ahidan:BOOL AddTool( CWnd* pWnd, UINT nIDText, LPCRECT lpRectTool = NULL, UINT nIDTool = 0 );BOOL AddTool( CWnd* pWnd, LPCTSTR lpszText = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT nIDTool = 0 );AddTool的第一个参数是CWnd*, 而不是ID
      

  11.   

    to zhou80bin(彬彬):
    谢谢了, 但iString指的是button的label的索引而不是tooltip的索引.