我想实现 编辑框 失去焦点 然后tooltip提示这一功能,我已经做到能提示,但是不知道为什么,tooltip显示的位置总在鼠标的当前位置,有什么方法能解决??? 还有,当我在数遍移动到 编辑框的时候 怎么不会弹出提示??
初始化函数中
EnableToolTips(TRUE);
m_toolTip.Create(this,TTS_BALLOON);
m_toolTip.Activate(TRUE);
m_toolTip.AddTool(&m_CardPwd,"空");
m_toolTip.SetTipTextColor(RGB(0,0,0));
m_toolTip.SetTitle(1,"提示");
m_toolTip.SetDelayTime(TTDT_INITIAL, 1);
m_toolTip.SetDelayTime(TTDT_AUTOPOP, 5000);
m_toolTip.SetDelayTime(TTDT_RESHOW, 5000);
鼠标移动到编辑框上没有提示 为什么?
然后我在 编辑框的 lostfocus 事件中 写下如下代码,tooltip能显示,但是位置总是在鼠标的位置
LRESULT CClearing::ShowToolTip(WPARAM wParam, LPARAM lParam)
{
ClearToolTipInfo * info=(ClearToolTipInfo *)wParam;
m_toolTip.Pop();
m_toolTip.UpdateTipText(info->strTipText,&m_CardPwd);
m_toolTip.SetTipTextColor(info->pTextColor);
MSG msg;
msg.hwnd =m_CardPwd.m_hWnd;
msg.message = WM_MOUSEMOVE;
m_toolTip.RelayEvent(&msg);
m_toolTip.Update();
return 1;
}
请高手指教!!
初始化函数中
EnableToolTips(TRUE);
m_toolTip.Create(this,TTS_BALLOON);
m_toolTip.Activate(TRUE);
m_toolTip.AddTool(&m_CardPwd,"空");
m_toolTip.SetTipTextColor(RGB(0,0,0));
m_toolTip.SetTitle(1,"提示");
m_toolTip.SetDelayTime(TTDT_INITIAL, 1);
m_toolTip.SetDelayTime(TTDT_AUTOPOP, 5000);
m_toolTip.SetDelayTime(TTDT_RESHOW, 5000);
鼠标移动到编辑框上没有提示 为什么?
然后我在 编辑框的 lostfocus 事件中 写下如下代码,tooltip能显示,但是位置总是在鼠标的位置
LRESULT CClearing::ShowToolTip(WPARAM wParam, LPARAM lParam)
{
ClearToolTipInfo * info=(ClearToolTipInfo *)wParam;
m_toolTip.Pop();
m_toolTip.UpdateTipText(info->strTipText,&m_CardPwd);
m_toolTip.SetTipTextColor(info->pTextColor);
MSG msg;
msg.hwnd =m_CardPwd.m_hWnd;
msg.message = WM_MOUSEMOVE;
m_toolTip.RelayEvent(&msg);
m_toolTip.Update();
return 1;
}
请高手指教!!
popup.hwnd = 编辑框的句柄;
::GetClientRect(编辑框的句柄,&popup.rect);::sendmessage(泡泡的句柄,TTM_ADDTOOL,0,(LPARAM)&popup);::SendMessage(泡泡的句柄,TTM_NEWTOOLRECT,0,(LPARAM)&popup);