在WPF中渲染Visual时的通知 [英] Notification when rendering a Visual in WPF is complete

查看:70
本文介绍了在WPF中渲染Visual时的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以在(重新)渲染视觉对象时得到通知(例如通过事件)?

Is there a way to get notified (e.g., by an event) when a Visual has been (re-)rendered?

基本上,我希望在Visual的外观发生变化时进行截屏.我认为渲染线程正在后台处理此问题.

Basically, I would like to take a screen shot whenever a Visual's appearance has changed. I assume the rendering thread is taking care of this in the background.

由于我只对更改感兴趣(例如,将光标悬停在按钮上会改变其外观),因此我试图避免定期抓取屏幕截图.

I am trying to avoid grabbing a screen shot periodically since I am only interested in changes (e.g., hovering the cursor over a button would change its appearance).

任何提示都非常感谢!

推荐答案

我发现的最好方法是将一个空白面板添加到布局根目录,并附上一个事件,例如更改尺寸并从那里开始工作.

The best way I've found is to add an empty panel to the layout root attach an event like on size changed and work from there.

这篇关于在WPF中渲染Visual时的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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