Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello there I have issue with overlapping of child windows,I have created a software with menu driven interface( IDR_MAINFRAME - CFormView
etc) and upon clicking one of the menu items another child-window appears( Dialog based ) where I do the calculations as a normal
calculator.Now if I open any other entry say conversion of metrics which is also in menu entry then on overlapping with any other such
window the background windows gets horribly disfigured and if i move about the calculator or the metrics conversion calculator randomly
they get disfigured and its a mess.Also I have put up a bitmap image on the background.Upon moving the calculator the background image also
gets erased.

Please let me know about how to handle this issue.I have googled and found that handling of paint messages or WM_ERASEBKGND helps ..but I
have tried this piece of code which just doesn't help in OnEraseBkGnd();
BOOL COfficesoftDlg::OnEraseBkgnd(CDC* pDC)
{
    // TODO: Add your message handler code here and/or call default
    CRect Rect;
    GetClientRect(Rect);
    //ClientToScreen(&Rect);
    //this->ScreenToClient(&Rect);
    this->InvalidateRect(Rect);
    return CDialog::OnEraseBkgnd(pDC);
}

how can i achieve the smooth overlapping of different windows like a notepad overlapping a word document or even a calculator or even a VC6
IDE in my project.
Please explain it with an example .I am just a newbie and I need to understand in detail...thanks and regards
Posted
Updated 19-Apr-11 21:14pm
v2
Comments
Toniyo Jackson 20-Apr-11 3:14am    
Use pre tag only for code

1 solution

When a window moves above another one, the window which was previously partially hidden receives a WM_ERASEBKGND message followed by a WM_PAINT message.

Make sure all your painting code is in the OnPaint or OnDraw (for CView-derived classes) functions.

You probably don't need to handle the WM_ERASEBKGND message in your case. Just try to put all painting code in OnPaint first.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900