Solved

Clearing a picture control in MFC

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 105
notReplace  challenge 53 142
only14 challenge 19 81
modThree challenge 4 98
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

830 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