Custom tool tip C++ class implements multiline and multicolor tool tip, which can be used to present different information, in several lines, using various colors:
CPP and H file can be reviewed and downloaded from following locations: source and header. The class is MFC dependent. Use of the class is simple:
void CCustomChartControl::OnMouseMove(UINT nFlags, CPoint point)
{
COLORREF color1, color2, color3;
CString strText1(_T("")), strText2(_T("")), strText3(_T(""));
// initialize colors and texts
// ...
if (m_pWndToolTip == NULL)
{
m_pWndToolTip = new CCustomToolTip();
if (!m_pWndToolTip->Create(this))
{
TRACE(_T("Couldn't create tool tip window!"));
}
else
{
m_pWndToolTip->ShowToolTip(TRUE);
}
}
if (m_pWndToolTip != NULL)
{
m_pWndToolTip->UpdateText(strText1, strText2, strText3,
true, true, true,
true, true, true,
color1, color2, color3,
point);
}
}
In method CCustomToolTip::UpdateText you can set texts with three different colors and visibility types (visible/not visible).
No comments:
Post a Comment