2.添加鼠标响应函数 5.2 void CMove TestView: OnL Button Down(UINT nFlags, CPoint point) if(flag=="track") struct pointstruct * temppoint while(point listhead) temppoint = pointlisthead pointlisthead pointlisthead->next delete temppoint drawtrack=true CView: OnLButton Down(nF lags, point)
2.添加鼠标响应函数 5.2 void CMoveTestView::OnLButtonDown(UINT nFlags, CPoint point) { if(flag= ="track") { struct pointstruct *temppoint; while(pointlisthead) { temppoint = pointlisthead; pointlisthead = pointlisthead->next; delete temppoint; } drawtrack=true; } CView::OnLButtonDown(nFlags, point); }
5.2 void CMove TestView OnMouseMove UINT nFlags, CPoint point if(drawtrack) CClientDC dc(this) dc SetPixel(point x, point y, RGB(0,0, o)) struct pointstruct *newpoint=new struct pointstruct; newpoint->point X=pointX, wpoint->point y-point. y, newpoint->next=NULL f(pointlisthead==NULL) pointlisthead=pointlisttrainewpoint els
5.2 void CMoveTestView::OnMouseMove(UINT nFlags, CPoint point) { if(drawtrack) { CClientDC dc(this); dc.SetPixel(point.x,point.y,RGB(0,0,0)); struct pointstruct *newpoint=new struct pointstruct; newpoint->point.x=point.x; newpoint->point.y=point.y; newpoint->next=NULL; if(pointlisthead= =NULL) { pointlisthead=pointlisttrail=newpoint; } else { pointlisttrail->next=newpoint; pointlisttrail=newpoint; } } CView::OnMouseMove(nFlags, point); }