关于单文档下绘制动态坐标系,该如何解决
关于单文档下绘制动态坐标系
随着鼠标移动怎么去除之前画的坐标系而只保留本次绘画的坐标系?
------解决方案--------------------
鼠标消息的WM_MOUSEMOVE响应函数里修改坐标参数信息,然后强制刷新InvalidateRect,OnDraw函数中绘制图形
------解决方案--------------------
redrawwindow
- C/C++ code
void CPOINT1View::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CClientDC dc(this); CRect rect; InvalidateRect(&rect); //dc.FillRect(&rect,WHITE_BRUSH); GetClientRect(&rect); dc.MoveTo(0,point.y); dc.LineTo(rect.Width(),point.y); //InvalidateRect(&rect); dc.MoveTo(point.x,0); dc.LineTo(point.x,rect.Height()); CString str; str.Format(_T("x=%d y=%d"),point.x,point.y); ((CMainFrame*)GetParent())->m_wndStatusBar.SetWindowText(str); //Invalidate(); CView::OnMouseMove(nFlags, point); }
随着鼠标移动怎么去除之前画的坐标系而只保留本次绘画的坐标系?
------解决方案--------------------
鼠标消息的WM_MOUSEMOVE响应函数里修改坐标参数信息,然后强制刷新InvalidateRect,OnDraw函数中绘制图形
------解决方案--------------------
redrawwindow