其实对WM_MOUSEHOVER消息的处理,因为WindowImplBase基类中对此消息未处理,所以在自己的窗口类中实现:
.h文件中加入
LRESULT OnMouseHover( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
.cpp文件加入实现
LRESULT CLoginWnd::OnMouseHover( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
CControlUI* pHover = m_PaintManager.FindControl(pt);
if( pHover == NULL ) return ;
/*演示悬停在下载列表的图标上时,动态变换下载图标状态显示*/
if(pHover->GetName() == _T("testbtn"))
{
MessageBox(NULL, _T("鼠标在某控件例如按钮上悬停后,对目标控件操作,这里改变了状态图标大小"), _T("DUILIB DEMO"), MB_OK);
((CButtonUI *)pHover)->ApplyAttributeList(
_T("normalimage=\"file='downlist_pause.png' dest='15,9,32,26'\""));
}
return ;
}