// 更加严谨的写法可以避免是Down和Up都发生在当前窗口
void OnMButtonDown(UINT nFlags, CPoint point)
{
m_bMBttonDown = TRUE;
SetCapture();
}
void OnMButtonUp(UINT nFlags, CPoint point)
{
if (m_bMBttonDown)
{
m_bMBttonDown = FALSE;
ReleaseCapture();
}
}
void OnMouseMove(UINT nFlags, CPoint point)
{
CRect rect;
GetClientRect(rect);
if (m_bMBttonDown && rect.PtInRect(point))
{
...
Invalidate();
}
}
OnMouseMove消息需要注意OnMButtonDown、OnMButtonUp的位置
最新推荐文章于 2023-06-21 16:46:03 发布