*********************************************************************************
i'm trying to make some drawing with the mouse,for that purpose i have wrote the following code but there is no results displayed on the window.I can't find what's wrong with the code:
i'm trying to make some drawing with the mouse,for that purpose i have wrote the following code but there is no results displayed on the window.I can't find what's wrong with the code:
Code:
void CResizableRectanglesView::OnLButtonDown(UINT nFlags, CPoint point)
{
drawing = true;
beginPoint = point;
oldPoint = beginPoint;
CView::OnLButtonDown( nFlags, point );
}
void CResizableRectanglesView::OnLButtonUp(UINT nFlags, CPoint point)
{
if(drawing)
{
drawing = false;
CPaintDC dc(this);
ropOld = dc.SetROP2(R2_NOTXORPEN);
thisPoint = point;
dc.Rectangle( beginPoint.x, beginPoint.y, oldPoint.x, oldPoint.y );
dc.SetROP2(ropOld);
dc.Rectangle( beginPoint.x, beginPoint.y, thisPoint.x, thisPoint.y );
}
CView::OnLButtonUp( nFlags, point );
}
void CResizableRectanglesView::OnMouseMove(UINT nFlags, CPoint point)
{
if( drawing )
{
CPaintDC dc(this);
ropOld = dc.SetROP2(R2_NOTXORPEN);
thisPoint = point;
dc.Rectangle( beginPoint.x, beginPoint.y, oldPoint.x, oldPoint.y );
dc.Rectangle( beginPoint.x, beginPoint.y, thisPoint.x, thisPoint.y );
oldPoint = thisPoint;
dc.SetROP2(ropOld);
}
CView::OnMouseMove( nFlags, point );
}
[\code]