本文整理汇总了C++中CControlBase::OnMouseMove方法的典型用法代码示例。如果您正苦于以下问题:C++ CControlBase::OnMouseMove方法的具体用法?C++ CControlBase::OnMouseMove怎么用?C++ CControlBase::OnMouseMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CControlBase
的用法示例。
在下文中一共展示了CControlBase::OnMouseMove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseMove
// 鼠标移动事件处理
BOOL CControlBase::OnMouseMove(UINT nFlags, CPoint point)
{
if(!m_bIsVisible || !m_bRresponse) return false;
// 保存原始的鼠标位置,并进行位置变换
CPoint oldPoint = point;
OnMousePointChange(point);
BOOL bRresponse = false;
if(m_pControl)
{
CPoint pt = point;
// 如果是控件内置滚动条子控件,则不进行位置变换,因为滚动条位置是不需要变换的
UINT uControlID = m_pControl->GetControlID();
if((SCROLL_V == uControlID) || (SCROLL_H == uControlID))
{
pt = oldPoint;
}
if((m_pControl->PtInRect(pt) && m_pControl->OnCheckMouseResponse(nFlags, pt)) || m_bMouseDown)
{
if(m_pControl->OnMouseMove(nFlags, pt))
{
return true;
}
return false;
}
}
CControlBase * pOldControl = m_pControl;
m_pControl = NULL;
if(!m_strTooltip.IsEmpty() && PtInRect(point) && OnCheckMouseResponse(nFlags, point))
{
// 如果当前控件有Tooltip,并且当前Tooltip设置的是其他控件,则设置Tooltip
if(GetTooltipCtrlID() != GetID())
{
SetTooltip(this, m_strTooltip, m_rc, FALSE, m_nTipWidth);
SetTooltipCtrlID(GetID());
}
}
// 调用控件的设置鼠标光标函数
OnControlSetCursor(nFlags, point);
// 调用控件的鼠标移动函数
bRresponse = OnControlMouseMove(nFlags, point);
// 发送鼠标移动的DUI消息
if(m_bDuiMsgMouseMove)
{
if(PtInRect(point))
{
// 发送鼠标在控件范围内移动的消息
SendMessage(MSG_MOUSE_MOVE, (WPARAM)nFlags, (LPARAM)(&point));
m_bMouseLeave = FALSE;
}else
{
if(!m_bMouseLeave)
{
// 发送鼠标离开控件的消息(离开之后仅发送一次离开消息)
SendMessage(MSG_MOUSE_LEAVE, (WPARAM)nFlags, (LPARAM)(&point));
m_bMouseLeave = TRUE;
}
}
}
if(!m_bMouseDown)
{
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
CPoint pt = point;
// 如果是控件内置滚动条子控件,则不进行位置变换,因为滚动条位置是不需要变换的
UINT uControlID = pControlBase->GetControlID();
if((SCROLL_V == uControlID) || (SCROLL_H == uControlID))
{
pt = oldPoint;
}
if(pControlBase->OnMouseMove(nFlags, pt))
{
if(pControlBase->PtInRect(pt))
{
m_pControl = pControlBase;
}
bRresponse = true;
}
}
}
if (pOldControl)
{
bRresponse = true;
}
if (m_pControl)
{
//.........这里部分代码省略.........
示例2: OnMouseMove
// 鼠标移动事件处理
BOOL CControlBase::OnMouseMove(UINT nFlags, CPoint point)
{
if(!m_bIsVisible || !m_bRresponse) return false;
OnMousePointChange(point);
BOOL bRresponse = false;
if(m_pControl)
{
if((m_pControl->PtInRect(point) && m_pControl->OnCheckMouseResponse(nFlags, point)) || m_bMouseDown)
{
if(m_pControl->OnMouseMove(nFlags, point))
{
return true;
}
return false;
}
}
CControlBase * pOldControl = m_pControl;
m_pControl = NULL;
if(!m_strTooltip.IsEmpty() && PtInRect(point) && OnCheckMouseResponse(nFlags, point))
{
// 如果当前控件有Tooltip,则添加一个Tooltip
CDlgBase* pDlg = GetParentDialog();
if(pDlg && (pDlg->GetTooltipCtrlID() != GetID()))
{
pDlg->SetTooltip(this, m_strTooltip, m_rc);
pDlg->SetTooltipCtrlID(GetID());
}
}
bRresponse = OnControlMouseMove(nFlags, point);
if(!m_bMouseDown)
{
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
if(pControlBase->OnMouseMove(nFlags, point))
{
if(pControlBase->PtInRect(point))
{
m_pControl = pControlBase;
}
bRresponse = true;
}
}
}
if (pOldControl)
{
bRresponse = true;
}
if (m_pControl)
{
bRresponse = true;
}
}
return bRresponse;
}
示例3: OnMouseMove
void CDlgPopup::OnMouseMove(UINT nFlags, CPoint point)
{
if (!m_bTracking)
{
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_LEAVE | TME_HOVER;
tme.dwHoverTime = 1;
m_bTracking = ::_TrackMouseEvent(&tme);
}
BOOL bInvalidateRect = false;
if (m_pControl)
{
if(((m_pControl->PtInRect(point) && m_pControl->OnCheckMouseResponse(nFlags, point)) || m_bIsLButtonDown) && m_bTracking)
{
m_pControl->OnMouseMove(nFlags, point);
return;
}
}
if (!m_bIsLButtonDown)
{
CControlBase * pOldControl = m_pControl;
BOOL bIsSelect = FALSE;
BOOL bIsSystemSelect = FALSE;
if(m_bTracking)
{
// 用户控件
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
pControlBase->OnMouseMove(nFlags, point);
if (!bIsSystemSelect)
{
if(pControlBase->PtInRect(point) && pControlBase->GetRresponse())
{
m_pControl = pControlBase;
bIsSelect = TRUE;
}
}
}
}
}
if (!bIsSelect && !bIsSystemSelect)
{
m_pControl = NULL;
}
// 调用自身的OnMouseMove
if(OnMouseMove(point))
{
DrawWindow();
}
}
}