Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Update Child's Window View

Posted on 2002-07-08
7
Medium Priority
?
428 Views
Last Modified: 2013-11-20
I created a form view using MFC. There's a window (child window) in the form view. The child window is used to display a jpeg image. I managed to display the image in the child window. My problem is when I minimize the window and then maximize it again, the image in the sub window disappear. I put some code in the CView::OnDraw function but it doesn't work :

void CTestImgView::OnDraw(CDC* pDC)
{
Image cImage(L"c:\\inetpub\\ftproot\\live\\image_cam1_418.jpg");
     
     CDC* pCamDC = m_cCam1.GetDC();

     Graphics graphics(pCamDC->GetSafeHdc());

     graphics.DrawImage(&cImage, 10, 10);

     m_cCam1.ReleaseDC(pCamDC);

m_cCam1 is the subwindow.
}

Can sombody help ?
 
0
Comment
Question by:kctan100
[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
7 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7139644
Set WS_CLIPCHILDREN style to child window using ModifyStyle() API.

Roshmon
0
 

Author Comment

by:kctan100
ID: 7140550
Setting the style to WS_CLIPCHILDREN doesn't seem to help.

The child window is actually an active-X control derived from CWnd. When I minimize or maximize the parent window, the image in the child window disappeared.
The idea is to have the image redrawn in the child whenever the parent window get minimize, maximize or overlapping with other windows occur.

0
 
LVL 1

Expert Comment

by:gurly
ID: 7140562
Did you try bringing the child window to top ? maybe it is just hidden.
0
 

Author Comment

by:kctan100
ID: 7142856
I did it..but it doesn't solve the problem.
0
 
LVL 8

Accepted Solution

by:
fl0yd earned 150 total points
ID: 7149123
You need to call
InvalidateRect( NULL, TRUE );
to add the entire region of the child window to the update-list and a
UpdateWindow();
to finally paint all invalidated window areas.

Put those two function calls in a WM_ACTIVATE-message handler.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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…

715 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