Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 26th, 2006, 5:50 AM   #1
Exodust
Newbie
 
Join Date: Mar 2006
Location: India, The great :p
Posts: 7
Rep Power: 0 Exodust is on a distinguished road
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)
Attached Files
File Type: zip painter.zip (2.4 KB, 12 views)
__________________
My Blog!!
Exodust is offline   Reply With Quote
Old Mar 26th, 2006, 6:02 AM   #2
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
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.
Polyphemus_ is offline   Reply With Quote
Old Mar 26th, 2006, 6:32 AM   #3
Exodust
Newbie
 
Join Date: Mar 2006
Location: India, The great :p
Posts: 7
Rep Power: 0 Exodust is on a distinguished road
Yes, I'm using win32 api. And i'm drawing directly to the device context too. So how do I impliment the buffer thing and what is bitblt? Thanks for help.
__________________
My Blog!!
Exodust is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:08 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC