Hello everyone.
I have implemented a custom tooltip below is the code. Below is the function taht is called at last while drawing the tip.
CClientDC dc(this);
DrawTip(&dc);
void CustomToolTipPlain::DrawTip(CDC *pDC)
{
if (pDC)
{
BITMAP bm;
m_tipImage->GetBitmap(&bm);
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
CBitmap *oldBitmap = dcMem.SelectObject(m_tipImage);
pDC->BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcMem, 0, 0, SRCCOPY);
dcMem.SelectObject(oldBitmap);
}
}
There is also another function
void CustomToolTip::OnTimer(UINT)
{
if (!MouseInTipArea())
{
HideTip();
}
else
{
ShowWindow(SW_SHOW);
}
}
Now in the situation where the Ontimer function is called before even calling the CClientDC dc(this); and finishing the drawing (DrawTip(&dc);
)
My tooltip is always blank in this situation and it doesn't draw anything. It just shows a blank window from the ShowWindow(SW_SHOW) function of the OnTimer.
From the debugging its clear that the call to CClientDC dc(this); is giving a blank dc value when the window is open. Is this true,do you guys think this is the reason? So my question is:
Does CClientDC dc(this); fails when the client windows is open?