Solved

Update Child's Window View

Posted on 2002-07-08
7
426 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 50 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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 117
Process filename extension 3 218
ERP and the other system process verification 5 26
Message not shown 5 106
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

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