MFC ActiveX未正确重绘 [英] MFC ActiveX not properly redrawn

查看:111
本文介绍了MFC ActiveX未正确重绘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计,



我正面临一个让我疯狂的恼人问题。



在我的CView派生视图中,我放置了一个由一些按钮组成的ActiveX控件 - 没什么特别的或特别的。在开始时它显示正确,但在视图的OnUpdate() - 方法之后,Control不再显示 - 它只是一个白色平面。当我现在调整视图大小时,控件再次正确绘制。此外,当我点击白色平面上的某个位置时,光标下方的控件按钮会再次显示 - 其他按钮保持白色。



我已经尝试过Invalidate()控件没有成功。



任何提示或技巧?

Hey Folks,

I'm facing an annoying problem that drives me nuts.

On my CView-derived view I placed an ActiveX Control that consists of some buttons - nothing fancy or special. At the beginning it is shown correctly but after the OnUpdate()-method of the view the Control is not shown anymore - it's just a white plane. When I now resize the view the control is painted again correctly. Also when I click somewhere on the white plane the control's button underneath my cursor is then shown again - the others remain white.

I tried already to Invalidate() the control with no success.

Any hints or tips?

推荐答案

这*通常*表示包含窗口正在处理WM_ERASEBKGND窗口消息。如果Active-X控件绘制它自己的背景 - 拥有包含窗口,这是一种浪费,也会导致闪烁。覆盖此消息以返回非零值(例如1)以抑制此行为。



http://msdn.microsoft.com/en-us/library/windows/desktop/ms648055%28v=vs。 85%29.aspx [ ^ ]



要检查的另一件事是包含窗口的样式。包含窗口应该设置WS_CLIPCHILDREN样式,以便它不会绘制/擦除其子窗口。



http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v= vs.85%29.aspx [ ^ ]
This *usually* means the containing window is processing the WM_ERASEBKGND windows message. If the Active-X control draws it's own background - having the containing window do this is a waste and also causes flicker. Override this message to return a non-zero value (eg. 1) to suppress this behavior.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms648055%28v=vs.85%29.aspx[^]

Another thing to check is the containing window's style. The containing window should have the WS_CLIPCHILDREN style set so that it doesn't draw / erase its child windows.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx[^]


这篇关于MFC ActiveX未正确重绘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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