16,472
社区成员
发帖
与我相关
我的任务
分享
void CTView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_StartPoint=point;
m_LastEndPoint=point;
SetCapture();
CView::OnLButtonDown(nFlags, point);
}
void CTView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(GetCapture()==this)
{
CClientDC dc(this);
ReleaseCapture();
dc.MoveTo(m_StartPoint);
dc.LineTo(point);
}
CView::OnLButtonUp(nFlags, point);
}
void CTView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(nFlags && MK_LBUTTON)
{
CClientDC dc(this);
int nDrawMode=dc.GetROP2();
dc.SetROP2(R2_NOTXORPEN);
dc.MoveTo(m_StartPoint);
dc.LineTo(m_LastEndPoint);
dc.MoveTo(m_StartPoint);
dc.LineTo(point);
m_LastEndPoint=point;
dc.SetROP2(nDrawMode);
}
CView::OnMouseMove(nFlags, point);
}