如何样在鼠标放到按钮下时显示提示换行
怎么样在鼠标放到按钮上时显示提示换行。
1.建立一个全局的变量:CToolTipCtrl m_tooltip;
2.在OnInitDialog中加入初始部分:
if (!m_tooltip.Create(this, TTS_ALWAYSTIP))
{
TRACE(_T("Unable To create ToolTip\n"));
return FALSE;
}
m_tooltip.AddTool(GetDlgItem(IDC_BUTTON1),_T("this is button\r\nfilename"));
3.重载PreTranslateMessage函数,加入
if(pMsg->message== WM_LBUTTONDOWN ||pMsg->message== WM_LBUTTONUP || pMsg->message== WM_MOUSEMOVE)
m_tooltip.RelayEvent(pMsg);
这样就能在ID为IDC_BUTTON1的按钮上出现提示了.
但是提示语言不换行,我想让提示字符串变成:
this is button
filename
的效果怎么实现?谢谢帮忙
------解决方案--------------------
m_Tip.SetMaxTipWidth(50);// 设置下合理的宽度就能换行了。。。
\r\n or \n 是无效的!!
1.建立一个全局的变量:CToolTipCtrl m_tooltip;
2.在OnInitDialog中加入初始部分:
if (!m_tooltip.Create(this, TTS_ALWAYSTIP))
{
TRACE(_T("Unable To create ToolTip\n"));
return FALSE;
}
m_tooltip.AddTool(GetDlgItem(IDC_BUTTON1),_T("this is button\r\nfilename"));
3.重载PreTranslateMessage函数,加入
if(pMsg->message== WM_LBUTTONDOWN ||pMsg->message== WM_LBUTTONUP || pMsg->message== WM_MOUSEMOVE)
m_tooltip.RelayEvent(pMsg);
这样就能在ID为IDC_BUTTON1的按钮上出现提示了.
但是提示语言不换行,我想让提示字符串变成:
this is button
filename
的效果怎么实现?谢谢帮忙
------解决方案--------------------
m_Tip.SetMaxTipWidth(50);// 设置下合理的宽度就能换行了。。。
\r\n or \n 是无效的!!