
Change color background of astatic text
thanks,
I found this code in Charles Petzold book:
//////////////////////////////////////////////////////////
///////////////////
// CStatic1 message handlers
void CStatic1::OnMouseMove(UINT nFlags, CPoint point)
{
if (!m_bMouseOver)
{
this->SetWindowText("1111111");
m_bMouseOver = TRUE;
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_HOVER | TME_LEAVE;
tme.hwndTrack = CStatic1::GetSafeHwnd();
tme.dwHoverTime = HOVER_DEFAULT;
::TrackMouseEvent(&tme);
}
//CStatic::OnMouseMove(nFlags, point);
Quote:
}
//******************************************************
LRESULT CStatic1::OnMouseLeave(WPARAM wParam, LPARAM
lParam)
{
m_bMouseOver = FALSE;
this->SetWindowText("qqqqqqqq");
return 0;
Quote:
}
//***************************************************
But ::TrackMouseEvent give me a compiler error.
Do you know how can I execute TrackMouseEvent inside a
class derived from CStatic ?
Thanks again for your help,
Eduardo
Quote:
>-----Original Message-----
>Map messages WM_MOUSEMOVE, WM_MOUSELEAVE and
WM_CTLCOLOR..
>Set a flag in WM_MOUSEMOVE and reset this in
WM_MOUSELEAVE. According to
Quote:
>this flag create a brush and return in WM_CTLCOLOR.
>Soorej
>> How can I change the background color of a static text
>> when the mouse is over it, and as soon as mouse-pointer
>> leave color back to transparent.
>> thanks in advance for your help,
>> Eduardo
>.