谢谢了 我弄出来了 在OnMouseMove中加入
if(m_flag==1)
{
CPen
newPen1(PS_SOLID,
0,RGB(255,0,0));
CPen
*
pOldPen1
=
m_Pdc->SelectObject(&newPen1);
int
nOldMode1;
nOldMode1
=
m_Pdc->SetROP2(R2_NOTXORPEN);
m_Pdc->MoveTo(0,oldbegin);
m_Pdc->LineTo(rc.Width() ,oldbegin);
m_Pdc->SetROP2(nOldMode1);
m_Pdc->SelectObject(pOldPen1);
oldbegin=point.y;
m_flag=0;
}
if(m_flag==0)
{
CPen
newPen(PS_SOLID,
0,RGB(255,0,0));
CPen
*
pOldPen
=
m_Pdc->SelectObject(&newPen);
int
nOldMode;
nOldMode
=
m_Pdc->SetROP2(R2_NOTXORPEN);
m_Pdc->MoveTo(0,oldbegin);
m_Pdc->LineTo(rc.Width() ,oldbegin);
m_Pdc->SetROP2(nOldMode);
m_Pdc->SelectObject(pOldPen);
m_flag=1;
}