Visual C ++ 6中对话框窗口的重叠 [英] Overlapping of dialog windows in Visual C++ 6
问题描述
您好,我有子窗口重叠的问题,我创建了带有菜单驱动界面的软件(IDR_MAINFRAME-CFormView
等),然后单击菜单项之一,出现另一个子窗口(基于对话框),在这里我像正常情况一样进行计算
计算器.现在,如果我打开任何其他条目,请说同样在菜单条目中的度量标准转换,然后与其他任何此类重叠
窗口,背景窗口被严重毁容,并且如果我随意移动计算器或指标转换计算器
它们会毁容并变得一团糟.此外,我还在背景上放置了位图图像.移动计算器后,背景图像也
被擦除.
请让我知道如何处理此问题.我在Google上搜索后发现,处理油漆消息或WM_ERASEBKGND有助于..但是我
尝试过这段代码,但这对OnEraseBkGnd()毫无帮助;
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);
}
我如何才能实现不同窗口的平滑重叠,例如记事本重叠了Word文档甚至是计算器甚至是VC6
我项目中的IDE.
请举例说明.我只是一个新手,我需要详细了解......和问候.
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
推荐答案
当一个窗口移到另一个窗口上方时,先前被部分隐藏的窗口会收到WM_ERASEBKGND
消息,然后是WM_PAINT
消息.
确保所有绘画代码都在OnPaint
或OnDraw
(对于CView派生的类)函数中.
在您的情况下,您可能不需要处理WM_ERASEBKGND
消息.只需尝试先将所有绘画代码放在OnPaint
中.
When a window moves above another one, the window which was previously partially hidden receives aWM_ERASEBKGND
message followed by aWM_PAINT
message.
Make sure all your painting code is in theOnPaint
orOnDraw
(for CView-derived classes) functions.
You probably don''t need to handle theWM_ERASEBKGND
message in your case. Just try to put all painting code inOnPaint
first.
这篇关于Visual C ++ 6中对话框窗口的重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!