Visual C 中对话框窗口的有效重叠6

发布于 2024-11-02 10:14:21 字数 796 浏览 4 评论 0原文

您好,我有子窗口重叠的问题,我创建了一个带有菜单驱动界面的软件(IDR_MAINFRAME - CFormView

等),单击其中一个菜单项后,会出现另一个子窗口(基于对话框),我在其中进行计算现在

,如果我打开任何其他条目,比如菜单条目中的度量转换,那么在与任何其他此类

窗口重叠时,背景窗口会严重变形,如果我随机移动计算器或度量转换计算器,

它们会得到毁容了,一团糟。我还在背景上放了一个位图图像。移动计算器时,背景图像也 被删除。

请让我知道如何处理这个问题。我用谷歌搜索并发现处理绘画消息或 WM_ERASEBKGND 有帮助..但我

已经尝试过这段代码,它对 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。 请用例子解释一下。我只是一个新手,我需要详细了解......谢谢和问候

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

决绝 2024-11-09 10:14:21
  1. 覆盖 OnEraseBkgnd 并返回 true,以便它停止擦除您正在绘制的背景。返回 TRUE 表示您已完成工作。如果您只是调用基类实现,它会为您执行此操作,并且您将丢失背景,直到它有机会绘制为止。
  2. 由于某种原因,您没有收到父窗口的绘制消息。确保您以正确的方式调用模式。 DoModal() 工作正常。确保您不仅仅是创建并显示模式。
  3. 如果您的窗口是同一对话框/窗口上的子窗口并且它们重叠,或者您在任一对话框/窗口上都有子窗口,请确保使用clipchildren 和clipsiblings(如果窗口上的子窗口重叠)。否则,他们将按照他们选择的任何顺序进行绘画,并在整个地方进行人工制作。
  4. 确保您正在根据内存进行绘画并按位恢复到对话框,否则您将得到闪烁的效果。
  1. Override OnEraseBkgnd and return true so it stops erasing the background you're painting. Returning TRUE says that you've done the work. If you simply call the base class implementation, it's going to do this for you, and you'll lose the background until it gets a chance to paint.
  2. You're not getting paint messages to the parent window for some reason. Make sure you're calling the modal in the correct manner. DoModal() works fine. Make sure you're not just creating the modal and showing it.
  3. If your windows are children on the same dialog/window and they overlap or you have children on either dialog/window, make sure that you use clipchildren and clipsiblings (if children on a window overlap). Otherwise they'll get to paint in any order they choose artifacting all over the place.
  4. Ensure that you're painting to memory and bitblting back to your dialog, otherwise you'll get a flashing effect.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文