如何在单文档中动态画线?

来源:百度知道 编辑:UC知道 时间:2024/05/17 07:01:56
在MFC的单文档程序中如何设置Ontimer函数及画线函数,使视图自然显现点动成线的效果?要比较详细的程序过程

void CLView::OnDraw(CDC* pDC)
{
CLDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
SetTimer(0, 10, NULL);
}

void CLView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
static int x =0, y = 0;
CDC* pDC = GetDC();
pDC->LineTo(x++,y++);
ReleaseDC(pDC);
CView::OnTimer(nIDEvent);
}