Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Clearing a picture control in MFC

Posted on 2004-10-05
3
Medium Priority
?
1,261 Views
Last Modified: 2013-11-20
hi,

   I am a newbie for MFC. I constructed a gui in which i placed two picture controls. In one picture control i loaded an image using loadBitmap function. In second one i used BitBlt function to display processed image. I am facing problem of clearing the 2nd picture control. can anybody help me regarding this.
0
Comment
Question by:chaitanyapaturu
  • 2
3 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 12226100
I guess you use BitBlt in WM_PAINT message handler. It should be something like this:

if ( m_bShowImage )       // some flag
    BitBlt ...

To clear imge from any place use:

m_bShowImage = FALSE;
Invalidate();
UpdateWindow();

Now WM_PAINT is called again, but BitBlt is not called, picture control remains empty.
0
 

Author Comment

by:chaitanyapaturu
ID: 12226259
No, I have used Bitblt in a menu item handler function. I have drawn the image to picture control by getting its window handler using GetDlgItem function.
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 150 total points
ID: 12226297
All drawing code should be inside of WM_PAINT message handler. In menu handler you can load image and keep it in some class member. After this invalidate window, and is redrawn according to current program state.
If you draw inside of menu handler, minimise and restore the window and you can see picture disappears.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question