![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2006
Location: India, The great :p
Posts: 7
Rep Power: 0
![]() |
Visual C++ repaint problem
I have just started learning Visual C++, and I was trying to make a paint program, with some help from a book ofcourse. I managed to make one in which, the only features are draw freehand and erase. The problem is - Whenever I draw something and then resize the window, the drawing gets deleted. This doesn't happen while moving the window. I want to fix this. If someone knows, please help. I have attached all the files required. The program works like this-- Left mouse button to draw, right mouse button to erase. There is a premade cicle drawn in it, and if you erase this circle, and resize, it comes back. (Another problem)
__________________
My Blog!! |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
I didn't look at your code, but I think you are drawing directly to the device context, which can be cleared at any time. I recommend creating a buffer where you store the actual painting, and on the WM_PAINT notification you draw it to the device context using bitblt.
Note that I'm assuming you are using the Windows API here. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|