专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > .NET新技术

wpf中类似redrawWindow函数?解决方案

发布时间:2011-06-26 19:51:37 文章来源:www.iduyao.cn 采编人员:星星草
wpf中类似redrawWindow函数?
自定义一个控件,此控件需要每0.01s刷新一次,
我试着用DispatcherTimer类来刷新,在刷新时调用InvalidateVisual函数,让它可以调用OnRender重绘。

用Debug输出调试信息,刷新一次后,InvalidateVisual调用多次,OnRender才一次,
所以认为是InvalidateVisual没有立即重绘,导致没有正确绘制出需要的效果。

请问各位有没有其他的好的办法?

------解决方案--------------------
有关InvlidateVisual,MSDN上有介绍:
This method is not generally called from your application code. The WPF framework-level layout system does its own handling of changes in the visual tree of an element, and would be calling the equivalent of this method when necessary already. Calling this method is necessary only for advanced scenarios. One such advanced scenario is if you are creating a PropertyChangedCallback for a dependency property that is not on a Freezable or FrameworkElement derived class that still influences the layout when it changes.
不知道你的控件是不是符合这样的情况

------解决方案--------------------
vc++实现的
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: