15,978
社区成员
发帖
与我相关
我的任务
分享
PARAM:
pWnd 区域所在窗口指针
pszText 提示内容
pRect 提示区域
nIDTool ToolTipCtrl的ID,自己设置一个就是了
CXXToolTipCtrl类继承自CToolTipCtrl
BOOL CXXToolTipCtrl::AddRectTool(CWnd *pWnd, LPCTSTR pszText, LPCRECT pRect, UINT nIDTool)
{
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = pWnd->GetSafeHwnd();
ti.uId = nIDTool;
ti.hinst = AfxGetInstanceHandle();
ti.lpszText = (LPTSTR)pszText;
::CopyRect(&ti.rect, pRect);
return (BOOL)SendMessage(TTM_ADDTOOL, 0, (LPARAM) &ti);
}