Thursday, November 12, 2009

Create Animated Rectangle in VC++

filename:animateView.cpp


global variable:

int i=10,j=100;



void CAnimateView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default

CClientDC *pdc=new CClientDC(this);

while(i<300) { RedrawWindow(); CBrush br; br.CreateSolidBrush(RGB(i*3,0,j*6)); pdc->SelectObject(&br);
pdc->Rectangle(i,i,j,j);
i=i+5;
j=j+5;
Sleep(100);
}




CView::OnLButtonDown(nFlags, point);
}

No comments:

Post a Comment