开发者

Drawing in C++ using Visual Studio 2005

开发者 https://www.devze.com 2022-12-17 05:01 出处:网络
I have a problem with drawing in C++ using Visual Studio 2005. After event handling on MouseMove the开发者_如何学Python results of using DrawLine function appear in PictureBox but if some window overl

I have a problem with drawing in C++ using Visual Studio 2005. After event handling on MouseMove the开发者_如何学Python results of using DrawLine function appear in PictureBox but if some window overlap the part of PictureBox all pixels in this place dissapear after moving the window. How can I solve this problem?


In your MouseMove handler, you just want to store the points where you will draw the lines (but don't draw anything at that time). At the end of that handler, call InvalidateRect to tell Windows that your window needs re-painting. Windows will (eventually) respond to that with a WM_PAINT message. When you receive the WM_PAINT message, retrieve the points and do the actual drawing.

If you're doing anything other than bare Win32 programming, chances are that whatever framework you're using will handle a few bits and pieces of that for you, but the general structure normally remains roughly the same.

0

精彩评论

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

关注公众号