Solved

Clearing a picture control in MFC

Posted on 2004-10-05
3
1,202 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

626 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