如题,我要实现的是鼠标按下右键后拖动,将随鼠标的移动画出一个矩形区域,松开鼠标右键后矩形区域不消失。我的代码调了半天,没错误,但是不能得到想要的结果我的代码如下:void CJvxingView::OnDraw(CDC* pDC)
{
CJvxingDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
        DrawScene();
}
void CJvxingView::DrawScene(void)
{     glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      glPushMatrix();
glColor3f(255.0,0.0,0.0);
glRectf(OldPoint.x,OldPoint.y,LastPoint.x,LastPoint.y);
      glPopMatrix();
glFinish();
        SwapBuffers(wglGetCurrentDC());
}
void CJvxingView::OnRButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
OldPoint=point;
SetCapture();
}void CJvxingView::OnRButtonUp(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default 
LastPoint=point;
glColor3f(255.0,0.0,0.0);
glRectf(OldPoint.x,OldPoint.y,LastPoint.x,LastPoint.y);
ReleaseCapture();
       //Invalidate(TRUE);
}void CJvxingView::OnMouseMove(UINT nFlags, CPoint point) 
{   
// TODO: Add your message handler code here and/or call default
if(GetCapture()==this) 
{
 LastPoint=point;
          Invalidate(TRUE);
}
}
OldPoint,LastPoint为两个CPoint对象,在构造函数中初始化,分别表示鼠标右键按下时的点与拖动后的点。求好心人帮我看一下啊,急!