如何重新绘制我的CMainFrame窗口? [英] How do I repaint my CMainFrame window?

查看:448
本文介绍了如何重新绘制我的CMainFrame窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序本质上是doc / view,分别使用CMDIFrameWndEx和CMDIChildWndEx。



该应用程序使用四个不同的文档模板,所以我改变了一些东西,以便新菜单将是一个弹出菜单,人们可以从中选择要午餐的文件。这意味着主窗口的客户区域是普通的,午餐时是黑色(或者可能是深灰色),也就是之前的任何子框架都是通过新的或开放的。 (按预期点击新的或叠加儿童框架的白色背景。)



我不喜欢这样所以我覆盖OnPaint以便它将呈现JPEG图像到主窗口的客户区。



问题是我的覆盖有效,但它会立即被另一个我无法跟踪的代码覆盖。



我看到渲染的JPEG图像,然后黑色的初始黑色背景返回并停留。



如何防止我的OnPaint操作被覆盖?

哪个函数/程序最有可能负责覆盖?

这样的覆盖引起的函数/程序是否可以覆盖?

I have an app that is doc/view in nature and uses CMDIFrameWndEx and CMDIChildWndEx respectively.

The app uses four different document template so I change things so that the new menu will be a popup menu from which one can choose which document to lunch.The implication of this is that the client area of the main window is plain and with black (or perhaps dark grey) in colour at lunch, that is before any childframe is lunched via new or open. (clicking new or superimposed the white background of the child fram on it as expected.)

I did not like this so I overrode OnPaint so that it will render a JPEG image to the client area of the main window.

The problem is that my override works but it is immediately overridene by another code that I have not been able to track.

I see the rendered JPEG image then subsequently the black initial black background returns and stays.

How do I prevent my OnPaint operation from being overriden?
Which function/program is most likely responsible for the override?
Is such an override-causing function/program overrideable?

推荐答案

请看我过去的答案:

MFC Drawed lines消失了 [ ^ ],

缩放平移2D矢量图形C ++ [ ^ ]。



他们应该解释你的机制。您可以自己找到Windows Invalidate * API的MFC特定包装。



我如何防止我的OnPaint操作被覆盖?似乎没有多少实际意义,只是不要覆盖你不想覆盖的内容,或者允许你的类的用户覆盖他们想要的东西,因为它很有意义。与此同时,我想您需要了解这一点: https://msdn.microsoft.com/en -us / library / 0w2w91tf.aspx [ ^ ]。







请在下面的 flicker WM_ERASEBKGND 双缓冲上查看我的评论。

此CodeProject文章可以帮助您了解更多细节: Flicker MFC中的免费绘图 [ ^ ]。



-SA
Please see my past answers:
MFC Drawed lines is disappeared[^],
Zooming Panning 2D vector graphics C++[^].

They should explain your the mechanism. You can find MFC-specific wrappers of the Windows Invalidate* API yourself.

The part "How do I prevent my OnPaint operation from being overridden?" does not seem to make much practical sense, just don't override what you don't want to override, or allow the users of your class to override what they want, because it makes a lot of sense. At the same time, I guess you need to learn this: https://msdn.microsoft.com/en-us/library/0w2w91tf.aspx[^].



Please see my comment below on flicker, WM_ERASEBKGND and double buffering.
This CodeProject article can help you to understand further detail: Flicker Free Drawing In MFC[^].

—SA


这篇关于如何重新绘制我的CMainFrame窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆