简体   繁体   English

InvalidateRect然后Cimage.Draw()

[英]InvalidateRect then Cimage.Draw()

I try to create small animation (a moving PNG object) using: 我尝试使用以下方法创建小型动画(移动的PNG对象):

pDC -> GetWindow() -> InvalidateRect(lpRect); // Clear old Draw()
image.Draw(pDC -> GetSafeHdc(),MyBmpFile::Instance() -> getxDest(), MyBmpFile::Instance() -> getyDest(),50,50); // Draw my CImage
MyBmpFile::Instance() -> Update(pDC); // change xDest, yDest to new one, and move lpRect to new position

As long as I do not use invalidate() the PNG is drawing, but I need to clear the old one before I draw the next one. 只要不使用invalidate() ,PNG就会绘制,但是在绘制下一个之前,我需要清除旧的PNG。 When the above code compiles, there is nothing in my dialog window. 上面的代码编译时,我的对话框窗口中没有任何内容。

Ok the answer was simple : http://msdn.microsoft.com/en-us/library/6yz8we9y(v=vs.80).aspx 好的答案很简单: http : //msdn.microsoft.com/zh-cn/library/6yz8we9y(v=vs.80).aspx

I just need to UpdateWindow() after invalidate(); 我只需要在invalidate();之后使用UpdateWindow() invalidate();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM