void CrcTestDlg::OnBnClickedButton5()
{
// TODO: Add your control notification handler code here
CToolTipCtrl m_tooltip;
if(!m_tooltip.Create(this))
{
MessageBox(_T("创建CToolTip失败"));
}
else
{
 m_tooltip.AddTool(&m_edt, _T("编辑框提示!"));//m_E1替换成你自己的控件变量
 m_tooltip.SetDelayTime(100);
 m_tooltip.Activate(TRUE);

}
能不能弹出一个气球啊,怎么搞都弹不出来
我想,点Button5的时候,让m_edt(CEdit)弹出一个气球,一个很明显的提示,为什么弹不出来。
或者让m_edt闪几下,怎么搞?

解决方案 »

  1.   

    CToolTipCtrl m_tooltip; 不可以设为局部变量,在PreTranslateMessage()函数要用到
    m_tooltip.RelayEvent(pMsg);函数
      

  2.   

    m_tooltip.RelayEvent(pMsg);函数
    这个貌似只能我鼠标点到那个Edit上,才弹出一个气球,下了个工程也是这样,但我想自定义消息弹出气球怎么办,比如我点button,让它弹出
      

  3.   

    //头文件中添加如下内容
    //申明一个成员变量
    CToolTipCtrl m_tooltip;virtual BOOL PreTranslateMessage(MSG* pMsg);//cpp文件BOOL CDialogYourDialog::PreTranslateMessage(MSG* pMsg)
    {
         m_tooltip.RelayEvent(pMsg);     return CDialog::PreTranslateMessage(pMsg);
    }//在OnInitDialog()添加以下内容,仅仅是个例子,根据你自己的需要修改
    if(!m_tooltip.Create(this))
     {
      MessageBox(_T("创建CToolTip失败"));
     }
     else
     {
      m_tooltip.AddTool(&m_E1, _T("编辑框提示!"));//m_E1替换成你自己的控件变量
      m_tooltip.SetDelayTime(100);
     } 按钮事件中   m_tooltip.Activate(TRUE);