What is in DrawToolTipContent ?
(CDDS_PREPAINT is not used for the colors with Tooltips)
A quick test with FillRect and DrawText in CDDS_POSTPAINT :
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
After initializing the tooltip, I want to set up few custom formats.
my part1 code as follow:
m_hWndTooltip = ::CreateWindowEx(0, TOOLTIPS_CLASS, 0, dwStyle,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
m_hParent, 0, m_hInstance, 0);
TOOLINFO ti;
//...setup ti;
::SendMessage(m_hWndTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti);
if (SendMessage(m_hWndTooltip, TTM_TRACKACTIVATE, (WPARAM)TRUE, (LPARAM)&ti))
{
NMTTCUSTOMDRAW nmh; //Initialize setting
RECT rec;
GetWindowRect(m_hWndTooltip, &rec);
::SendMessage(m_hWnd, WM_NOTIFY, idFrom, (LPARAM)&nmh);
}
in part2, the NOTIFY called passed to winproc as follows:
case WM_NOTIFY:
{
switch (((LPNMHDR)lParam)->code)
{
case NM_CUSTOMDRAW:
const auto& lpNMCustomDraw = (LPNMTTCUSTOMDRAW)lParam;
OnToolTipCustomDraw(lpNMCustomDraw);
break;
}
}
//--------------------------------------------------------------
LRESULT OnToolTipCustomDraw(NMTTCUSTOMDRAW* pcd)
{
LRESULT result = CDRF_DODEFAULT;
switch (pcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
{
auto result1 = SetTextColor(pcd->nmcd.hdc, 0x000000FF);
if (CLR_INVALID == result1)
outputA("\nSet textcolor failded.");
result = CDRF_NOTIFYPOSTPAINT;
break;
}
}
return result;
}
however, after showing, the tooltip does not change format.
my question is:
Is the call setup for OnNotify correct or not? (i called it right after showing the tooltip)
Also, does the return value of OnToolTipCustomDraw work with winproc?
Thanks you!
What is in DrawToolTipContent ?
(CDDS_PREPAINT is not used for the colors with Tooltips)
A quick test with FillRect and DrawText in CDDS_POSTPAINT :