I think u r selecting the co-ordinate when user press left mouse button and when user moves pointer, u r drawing & erasing line. You need not frequently call the Invalidate(), ( You may call InvalidateRect()).
Supposing we have two CPoint object to denote the begin and end of line.
CPoint begin,end;
When user press left button, we initialize both (begin and end) with current value of co-oridantes.
And, whenver user move mouse, we write the code in OnMouseMove() to
1. Set the drawing mode R2_NOT using CDC::SetROP2.
2. Draw the line with previous co-ordinate to erase the previous line
3. Store the new co-ordinate in the end variable.
4. Draw the line.

And user release the mouse, we call InvalidateRect(). Rect area will determined by begin and end variables. and In OnDraw()/OnPaint() , we draw the line after setting the drawing mode R2_COPYPEN.

In OnPaint(), don't use CClientDC, use instead CPaintDC to draw.