Solved

Clearing a picture control in MFC

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now