16,548
社区成员




void Changerect::Draw (CDC* pdc,CPoint firstpoint,CPoint secondpoint)
{
CPen pen;
pen.CreatePen (PS_SOLID,1,RGB(255,0,0));
CPen* poldpen= pdc->SelectObject (&pen);
CBrush* poldbrush=(CBrush*)pdc->SelectStockObject (NULL_BRUSH);
this->lefttop =firstpoint;
this->rightbottom =secondpoint;
CRect rect(lefttop,rightbottom);
rect.NormalizeRect ();
pdc->Rectangle (rect);
pdc->SelectObject (poldpen);
pdc->SelectObject (poldbrush);
}
void CmoveView::OnMouseMove(UINT nFlags, CPoint point)
{
CClientDC dc(this);
//dc.SetROP2 (R2_NOT);
if(nFlags&MK_LBUTTON)
{
this->secondpoint =point;
if(pcr)
{
pcr->Draw (&dc,this->firstpoint ,this->secondpoint );
delete this->pcr ;
pcr=0;
}
pcr =new Changerect;
pcr->Draw (&dc,this->firstpoint ,this->secondpoint );
}
}