Solved

Clearing a picture control in MFC

Posted on 2004-10-05
3
1,180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 110
Looking for a specific application/software 2 124
abstract class with all non abstract mentods 6 87
MaxSpan challenge 9 140
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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