开发者

Oh, no! My text is flickering?

Basically, I'm trying to create an application that features a bunch of colored rectangles with text written on them that you can开发者_C百科 click, making it doing stuff. It runs pretty well, except for the fact that the text on each of the buttons (Created using DrawText()) is constantly flickering. Is there anything I can do to potentially fix this problem?


From your comment above, you describe calling the draw procedure of your application object form your main message loop. This is almost certainly the source of your problem. Not only will it lead to flickering, it sounds like you are running your application at 100% CPU utilization which is not good.

What you should do is handle the WM_PAINT message and only paint in response to that message. That is how Windows GUI apps are meant to work. I recommend you read up in any introductory Windows GUI book. The canonical such book is Petzold's Programming Windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜