title: MFC draw a cross line using OnMouseMove
body: <p>As follow code, I want use mpDC to draw a cross line on mouse point, 
  when I move the mouse, the cross line will shift with my mouse point,</p>
  
  <p>but maybe I dont know the usage of BitBlt, so I cant see any line in my draw area 
  (rectRange), </p>
  
  <pre><code>    CWnd *pWnd;
      CRect rect;
      CDC mShowDC;
      CBitmap mShowBmp;
      CPen mpen;
      CPen *mOldpen;
  
      CDC *mpDC;
  
      mpDC = GetDC();
  
      mShowDC.CreateCompatibleDC(mpDC);
      mShowBmp.CreateCompatibleBitmap(mpDC,rectRange.Width(),rectRange.Height());
      mShowDC.SelectObject(mShowBmp);
  
      BitBlt(mShowDC,0,0,rectRange.Width(),rectRange.Height(),
          mbkCurveDC,0,0,SRCCOPY);
  
      //InvalidateRect(rectRange);
      if(boolShowMouseLine)
      {
          mpen.CreatePen(PS_SOLID,1,RGB(0,0,0));
          mOldpen = mShowDC.SelectObject(&amp;mpen);
  
          mShowDC.MoveTo(rectRange.left,mMousePoint.y);
          mShowDC.LineTo(mMousePoint.x - 1,mMousePoint.y);
  
          mShowDC.MoveTo(mMousePoint.x + 1,mMousePoint.y);
          mShowDC.LineTo(rectRange.bottom,mMousePoint.y);
  
          mShowDC.MoveTo(mMousePoint.x,rectRange.top);
          mShowDC.LineTo(mMousePoint.x,mMousePoint.y - 1);
  
          mShowDC.MoveTo(mMousePoint.x,mMousePoint.y + 1);
          mShowDC.LineTo(mMousePoint.x,rectRange.right);
  
          mpen.DeleteObject();
          mShowDC.SelectObject(mOldpen);
      }
  
      mpDC-&gt;BitBlt(rectRange.left, rectRange.top,
          rectRange.Width(), rectRange.Height(), 
          &amp;mShowDC, rectRange.left, rectRange.top, SRCCOPY);
  </code></pre>
  
  <p>My another method to draw cross line as follow code</p>
  
  <pre><code> CDC *cdc;
  cdc = GetDC();
  
  if(boolShowMouseLine)
  {
      cdc-&gt;MoveTo(rectRange.left,mMousePoint.y);
      cdc-&gt;LineTo(mMousePoint.x - 1,mMousePoint.y);
  
      cdc-&gt;MoveTo(mMousePoint.x + 1,mMousePoint.y);
      cdc-&gt;LineTo(rectRange.right,mMousePoint.y);
  
      cdc-&gt;MoveTo(mMousePoint.x,rectRange.top);
      cdc-&gt;LineTo(mMousePoint.x,mMousePoint.y - 1);
  
      cdc-&gt;MoveTo(mMousePoint.x,mMousePoint.y + 1);
      cdc-&gt;LineTo(mMousePoint.x,rectRange.bottom);
  }
  </code></pre>
  
  <p>Current situation is the picture <img src="https://i.stack.imgur.com/5G3Bq.png" alt="enter image description here"></p>
  
  <p>but this code will draw many cross line when shift the mouse location,</p>
  
  <p>How do I Clear the previous cross line...</p>